我试图帮助我的朋友做一个猜谜项目,但由于某种原因,guess 变量是 NoneType。你能帮我和我的朋友吗?
注意:出于技术原因,我已将 input() 替换为“hi”。
answer = "whatthing" #Change this to the answer
still_guessing = True
attempts = 1
guess = 'hi'
while still_guessing and attempts < 3:
print(f'{guess}')
if guess == answer.lower():
print('Correct answer!')
final_score = (3 - attempts)
still_guessing = False
else:
guess = print('Sorry wrong answer. Try again.\n')
print(f'Tries: {attempts}\n')
print(f'You have {3 - attempts} left.\n')
attempts += 1
if attempts == 3:
print('You coudn\'t find the answer in three tries, u suck!\n')
print ('The correct …Run Code Online (Sandbox Code Playgroud)