-3
コードの入力セクションにエラーがあります。通常はうまくいきますが、このコードでは、なぜこのエラーが表示されているのか分かりません。私のhangmanプログラムの入力エラーを追跡するには?
print("Welcome to the game, Hangman!")
print("I am thinking of a word that is ",len(secretWord)," letters long.")
print("-------------")
n=8
G_new=''
k=''
while n>0 and secretWord!=G_new:
print("You have ",n," guesses left.")
G_old=[G_new,]
print("Available letters: ",getAvailableLetters (G_old)
**k=input("Please guess a letter: ")** #error in this line
g=k.lower()
G_new=G_old+[g,]
if isWordGuessed(secretWord, G_new)==True and g not in G_old:
print("Good guess: ",getGuessedWord(secretWord, G_new))
elif isWordGuessed(secretWord, G_new)==True and g in G_old:
print("Oops! You've already guessed that letter: ",getGuessedWord(secretWord, G_old))
else:
print("Oops! That letter is not in my word: ",getGuessedWord(secretWord, G_old))
n-=1
print("-------------")
if n==0 and secretWord!=G_new:
print("Sorry, you ran out of guesses. The word was ",str(secretWord),".")
elif n>=0 and secretWord==G_new:
print("Congratulations, you won!")
[いいタイトルを書くにはどうすればいいですか](http://meta.stackexchange.com/questions/10647/how-do-i-write-a-good-title)を読んでから、あなたの投稿[編集]。 – rene
どのようなエラーが表示されますか?それをあなたの質問に追加してください(より具体的なタイトルを追加するだけでなく)。 – halfer
この質問はエラーが何であるかを示していないので、トピック外です。投票を終了する。 – halfer