我是编码的新手,我希望对这个问题有所帮助。
我写的代码:
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'
我该如何解决/我该如何进行?