小明去超市购买水果
账单如下
苹果15香蕉22 ,葡萄15块5请将上面的数据存储到字典里 根据键盘输入的水果名称 查询购买这个水果的费用
fruits = {'苹果':15,'香蕉':22,'葡萄':15.5}
fruit = input()
print(fruits[fruit])
list_fruit = {'apple':15,'banana':22,'grape':15.5}
while True:
fruit = input("Please enter the type of fruit.\nPress 'q' to exit at any time.")
if fruit == 'q':
break
else:
print(list_fruit[fruit])