Hi I'm new to Python(3 to 4 days) and I'm working on a hangman game and have been having some problems that really annoy me.
Here is part of my script:
	Problems
1. I can't get python to replace the "blank" with the letter that my user chose.
I've tried a lot of things and I'm really getting frustrated.
2. When I'm running the program I always have to input something in quotes or it will give me some NameError or something. I've tried:
x = str('x')
and x = 'x' in a number of ways and it's not working. Please help
I'm runnning Python 2.5 on Windows Xp
Note: If you see the '-4' that's another little problem: when the spaces for the word appear it prints 4 more than the chosen word so I put '- 4'(not the best idea) if you can tell me how to fix that, that would be great.
Thanks
					Here is part of my script:
Code:
	c = input('Would you like to play hangman? Type y or n ')
        
        
        word = sample(('soccer', 'robbery', 'antibiotics'), 1)
        word = str(word)    
        spaces = len(word) - 4
        def hangman():
            print '-------- '
            print '|______| '
            print ' O '
            print ' O '
            print ' O '
            print ' O '
            print ' O '
            print '---- '
            print '|___| '
        def hangman1():
            hangman()
            m = '%s' % ('_ ' * spaces)
            print m 
            number = word.find(letter)
            m.split()
            m.replace('_', letter)
1. I can't get python to replace the "blank" with the letter that my user chose.
I've tried a lot of things and I'm really getting frustrated.
2. When I'm running the program I always have to input something in quotes or it will give me some NameError or something. I've tried:
x = str('x')
and x = 'x' in a number of ways and it's not working. Please help
I'm runnning Python 2.5 on Windows Xp
Note: If you see the '-4' that's another little problem: when the spaces for the word appear it prints 4 more than the chosen word so I put '- 4'(not the best idea) if you can tell me how to fix that, that would be great.
Thanks
Comment