0
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的一些代码的一部分。它说错误在行内:

dash[count - 1] = letterGuess
4

2 回答 2

0

Dash could only be of length 0 or not iterable.Print dash and cout derectly befor the line that causes the eror.

于 2013-03-29T23:10:49.513 回答
0

这意味着count大于 的长度dash。由于我们不知道dash应该包含什么,所以很难说更多。

于 2013-03-29T16:03:47.853 回答