用户:
Lu野空查看:0 回复:0 评论:0 创建时间:2022-06-04T19:10:43
【作品展示】

【作品介绍】
123
【作品源代码】
def check_guess(guess, answer):
global score
still_guessing = True
attempt = 0
while (still_guessing and attempt < 3):
if (guess.lower() == answer.lower()):
print('Correct Answer')
score = (score + 1)
still_guessing = False
else:
if (attempt < 2):
guess = input('Sorry wrong answer.Try again')
attempt = (attempt + 1)
if (attempt == 3):
print(('The correct answer is ' + answer))
score = 0
print('Guess the animal')
guess1 = input('Which bear lives at the North Pole?')
check_guess(guess1, 'polar bear')
guess2 = input('Which is the fastest land animal?')
check_guess(guess2, 'cheetah')
guess3 = input('Which is the largest animal?')
check_guess(guess3, 'blue whale')
print(('Your score is' + str(score)))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn