prize_dict = {
'0': "芭比娃娃",
'1': "变形金刚",
'2': "psp游戏机",
'3': "奥特曼",
'4': "遥控飞机",
'5': "chongqiwawa",
}
prize_msg = '''
0 芭比娃娃
1 变形金刚
2 psp游戏机
3 奥特曼
4 遥控飞机
5 chongqiwawa
'''
age_count = 0
age = 18
get_prize_dict = {}
prize_count = 0
while age_count < 3:
inp_age = input('请输入年龄:')
if not inp_age.isdigit():
print('输入有误')
continue
inp_age = int(inp_age)
if inp_age > age:
print('猜大了')
elif inp_age < age:
print('猜小了')
else:
print('猜对了')
while prize_count < 2:
print(f'请选择奖品:{prize_msg}')
prize_choice = input('>>')
if prize_choice not in prize_dict:
prize_count += 1
continue
else:
prize = prize_dict[prize_choice]
if prize not in get_prize_dict:
get_prize_dict[prize] = 1
else:
get_prize_dict[prize] += 1
prize_count += 1
print(get_prize_dict)
break
age_count += 1