用户:梅豆xsli查看:0 回复:0 评论:0 创建时间:2022-01-08T19:15:36
【作品展示】

【作品介绍】
你了解动物知识吗?了解的话就来动物知识竞猜吧!
【作品源代码】
def check_guess(guess, answer1, answer2):
global score
still_guessing = True
attempt = 0
while (still_guessing and attempt < 3):
if (guess.lower() == answer1.lower()):
print('Correct answer!(答案正确!加' + str(3 - attempt) '分!)')
score = ((score + 3) - attempt)
still_guessing = False
elif (guess == answer2):
print('Correct answer!(答案正确!加' + str(3 - attempt) '分!)')
score = ((score + 3) - attempt)
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(正确答案是)' + answer1) + '( ') + answer2) + ')'))
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