day07work

Guess Age

while count1 <3:
    age_inp = input('请输入年龄: ').strip()
    if not age_inp.isdigit():
        print("沙雕,tmd输数字!")
        continue
    age_inp = int(age_inp)
    if age_inp > 18:
        print('dnmd猜大了!')
    elif age_inp < 18:
        print('dnmd猜小了')
    else:
        print('哎呦运气不错!')
        count1 = 9999
        while count2 < 2:
            print(prize)
            prize_choice = input('请输入想要的奖品序号: ').strip()
            if prize_choice not in prize_dict:
                print('沙雕,没这个东西!')
                continue
            if not prize_choice.isdigit():
                print('沙雕,输数字!')
                continue
            if prize_dict[prize_choice] in prize_list:
                prize_list[prize_dict[prize_choice]] += 1
            else:
                prize_list[prize_dict[prize_choice]] = 1
            print(f'获得{prize_dict[prize_choice]}')
            count2 += 1
        print(f'你获得的奖品:{prize_list}')
    count1 += 1

Guess you like

Origin www.cnblogs.com/shenblog/p/11529846.html