elif letterGuess in letterList: # if the letter is one the word characters
count = 1
print (letterGuess, ' is in the word!')
for n in letterList:
if n == letterGuess: # replaces the dashes with letters
dash[count - 1] = letterGuess # takes the dash in position and replaces
count += 1
count = 0
이것은 행맨 (hangman)을위한 일부 코드의 일부입니다. 이 오류가 라인 내에서 말한다 :IndexError : 목록 할당 색인이 범위를 벗어남. Python 3이 의미는 무엇이며 어떻게 수정합니까?
dash[count - 1] = letterGuess
대시에는 단어의 모든 문자에 대시가 포함되어 있어야하므로 단어가 'hiya'이면 대시가 '----'입니다. 감사! – zara