I writing a program for Hangman in Python 2.7. I'm trying to get the program to create the gallows and the hanged figure rather than me assembling them as a string and placing them in a list. My problem is the output from successive print statements gives me what I want but when I put the code in a function the result is skewed e.g.
print chr(47).rjust(4), # Right arm
print chr(124), # backbone
print chr(92) + chr(124) # Left arm + tree
gives me this /|\ |
--- inner slashed are concatenated
In a function:
def erect_gallows(bad_guess):
if bad_guess == 1:
print chr() - - -
.....
.....
this gives me this -- / | \ |
with the slashes separated, out of alignment. Don't know why the print statements work outside but not inside the function. The function does not return anything, it just prints.