python实验3task3

import random
x=random.randint(1,31)
y=eval(input('猜猜2021年5月哪一天会是你的幸运日/n你有三次机会,猜吧'))
if x==y:
    print('lucky day')
else:
    i=0
    while i<2:
        if y==x:
            print('lucky day')
        elif y<x:
            print('猜早啦')
            y=eval(input('再猜'))
        i+=1
    else:
        if y==x:
            print('lucky day')
        else:
            print('次数用完')
            print(f'2021年5月你的幸运日是{x}号')

posted @ 2021-04-23 12:52  yyyl  阅读(45)  评论(1)    收藏  举报