我正在制作一个刽子手游戏,我需要制作一组下划线,即单词的长度,当用户正确猜出一个字母时,下划线集中的相应空格将成为正确猜出的字母。我怎样才能做到这一点?
userGuess = raw_input('Enter a letter or the word: ')
guessed = ''
def getWordList:
#just getting a word from a tct file and returning a random word from it
return word
def askForInput(userGuess):
xx = str(userGuess)
yy = xx.lower()
return yy
def showWord:
print'_ ' * len(word) #I know this part is wrong if I want to add the letters
print 'Guesses: %s' %guessed
if askForInput(userGuess) in word:
print 'There are %ss' %askForInput(userGuess).upper()
#now what can I do with showWord or how can I fix showWord?