概述
def shopping_procedure():
milk_tea_no = input('请选择您要购买的奶茶编号:')
goods_dic={}
while True:
if milk_tea_no not in goods_dic.keys():
if int(milk_tea_no) <= 5 and int(milk_tea_no) >= 1:
milk_tea_amount = int(input('请输入您要购买的数量:'))
goods_dic[milk_tea_no]=milk_tea_amount
else:
print('Woops!我们只售卖以上五种奶茶哦!新口味敬请期待!')
else:
milk_tea_amount = int(input('请输入您要购买的数量:'))
goods_dic[milk_tea_no]+=milk_tea_amount
milk_tea_no=input('您还需要其他口味吗?请输入您要购买的奶茶编号,完成购物请选择Q')
if milk_tea_no.upper()=='Q':
break
return goods_dic
def original_money(goods_dic):
money=0
for milk_tea_no, milk_tea_amount in goods_dic.items():
if milk_tea_no == "1":
price = 3
elif milk_tea_no == "2" or milk_tea_no == "3":
price = 5
elif milk_tea_no == "4" or milk_tea_no == "5":
price = 7
money += price * milk_tea_amount
return money
def shopping_print(goods_dic):
print('点单完成,您的购买详情为')
for milk_tea_no, milk_tea_amount in goods_dic.items():
print('您购买的是{}号奶茶,共购买{}杯'.format(milk_tea_no, milk_tea_amount))
money=original_money(goods_dic)
print('您的总消费额为:{}元'.format(money))
def shopping_log(goods_dic,vip_no,total_consumer_record):
for milk_tea_no, milk_tea_amount in goods_dic.items():
single_consumer_record = {}
single_consumer_record['vip_no']=vip_no
single_consumer_record['milk_tea_no']=milk_tea_no
single_consumer_record['milk_tea_amount']=milk_tea_amount
total_consumer_record.append(single_consumer_record)
return total_consumer_record
def main():
total_consumer_record = []
vip_dic = {}
i=1
while True:
print('n欢迎光临小象奶茶馆!本店售卖宇宙无敌奶茶,奶茶虽好,可不要贪杯哦!每次限尝鲜一种口味:n 1)原味冰奶茶 3元 2)香蕉冰奶茶 5元 '
' 3) 草莓冰奶茶 5元 4)蒟蒻冰奶茶 7元 5)珍珠冰奶茶 7元' )
print('本店每日接待20位顾客,您是今天第{}位幸运儿'.format(i))
goods_dic = shopping_procedure()
money = original_money(goods_dic)
vip_no = input('请输入您的会员号(新会员直接设置会员号即可,第二次消费才可享受会员价):')
shopping_print(goods_dic)
if vip_no in vip_dic.keys():
money *= 0.9
money = round(money,2)
print('您可以享受会员价,折后总价:{}元'.format(money))
else:
vip_phone_no=input('请输入您的手机号进行激活会员:')
vip_dic[vip_no]=vip_phone_no
total_consumer_record=shopping_log(goods_dic,vip_no,total_consumer_record)
print("n********************************************************")
print('t小象奶茶馆力争做一枚有态度、有思想的奶茶馆(傲娇脸)!nt祝您今日购物愉快!诚挚欢迎您再次光临!')
print("********************************************************")
i += 1
if i > 20:
print('今日已闭店,欢迎您明天光临!')
break
main()
最后
以上就是霸气期待为你收集整理的python费用结算系统_小象奶茶馆结算系统3.0版本(python)的全部内容,希望文章能够帮你解决python费用结算系统_小象奶茶馆结算系统3.0版本(python)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复