zoukankan      html  css  js  c++  java
  • 猜年龄游戏

    猜年龄游戏

    age=18
    count=0
    prize_msg='''
    0 芭比娃娃
    1 变形金刚
    2 psp游戏机
    3 奥特曼
    4 遥控飞机
    5 chongqiwawa
    '''
    prize_dict={
        '0': "芭比娃娃",
        '1': "变形金刚",
        '2': "psp游戏机",
        '3': "奥特曼",
        '4': "遥控飞机",
        '5': "chongqiwawa",
    }
    get_prize_dict={}
    while count<3:
        age_inp=input('请输入年龄')
        if not age_inp.isdigit():
            print('输入错误')
            continue
        age_inp_int=int(age_inp)
        if age_inp_int > age:
            print('大了')
        elif age_inp_int < age:
            print('小了')
        else:
            print('对了')
            prize_count=0
            while prize_count<2:
                print(prize_msg)
                prize_choice=input('请输入需要的奖品:')
                prize=prize_dict[prize_choice]
                if prize in get_prize_dict:
                    get_prize_dict[prize]+=1
                else:
                    get_prize_dict[prize]=1
                print(f'得到奖品:{prize}')
                prize_count+=1
           	print(f'总共得到奖品{get_prize_dict}')
            break
        count+=1
        
    
  • 相关阅读:
    Sword 17
    Sword 16
    Sword 15
    Sword 14-II
    Sword 14-I
    Sword 13
    Sword 11
    Sword 10-II
    Sword 10
    【python+selenium】三种等待方式
  • 原文地址:https://www.cnblogs.com/maqiaobin/p/11529208.html
Copyright © 2011-2022 走看看