私は絞首刑執行人のゲームを作っています。単語の長さであるアンダースコアのセットを作成する必要があります。ユーザーが文字を正しく推測すると、アンダースコアのセット内の対応するスペースが正しく推測される文字になります。これどうやってするの?
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?