Commit 27115919 by BellCodeEditor

save project

parent d442f8b4
Showing with 10 additions and 8 deletions
...@@ -11,13 +11,15 @@ ...@@ -11,13 +11,15 @@
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典 # 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
# dict_shop={"马":30,"牛":20,"鸡":5,"鱼":10} # dict_shop={"马":30,"牛":20,"鸡":5,"鱼":10}
# print(dict_shop) # print(dict_shop)
dict_robotshop={'老八的shit':35,'巴西草肉':30,'小鸟伏特加':3000000000000,'毛主席茅台':100000000000000000}
print(dict_robotshop) dict_student={}
while True: while True:
shop=input("欢迎光临,请问你需要什么?") name=input("输入学生姓名:")
if shop in dict_robotshop: number=float(input("输入学生成绩:"))
many=int(input("How many do you want?")) if name not in dict_student:
money=many*dict_robotshop[shop] dict_student[name]=number
print("您购买的"+str(many)+"个"+shop+"一共需要"+str(money)+"元~") print(dict_student)
else: else:
print("抱歉,暂时缺货哦,亲~") if number>dict_student[name]:
dict_student[name]=number
print(dict_student)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment