猜年龄游戏
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