ValueError:以10为底的int()的无效文字:

时间:2018-12-07 19:33:11

标签: python python-3.x

我是编码的新手,我希望对这个问题有所帮助。

Here is the task I got :

我写的代码:

guessed_word = input('Please Guess a Word: ')
number_of_letter = '_ ' * int(guessed_word)
print(number_of_letter)

代码输出:

Please Guess a Word: hang
Traceback (most recent call last):
  File "C:/Users/Liran/OneDrive/Desktop/Hangman2.py", line 13, in <module>
    number_of_letter = '_ ' * int(guessed_word)
ValueError: invalid literal for int() with base 10: 'hang'

我该如何解决/我该如何进行?

0 个答案:

没有答案