简单购物程序(续1)

Posted qianlanbaba

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单购物程序(续1)相关的知识,希望对你有一定的参考价值。

sum=0
shoppingcar=""
shuliang=0
dianxin={"蛋糕":5,"法式小面包":6,"绿豆糕":10}
yinliao={"可乐":3,"红茶 ":4,"啤酒":10}

userID=""
pwd=""
name={}
sex={}
jifen="0"
vip=""

bianhao=input("请输入”0”注册账号:")
if bianhao=="0":
name=input("请输入姓名:")
sex=input("请输入性别:")
userID=input("请输入账号:")
pwd=input("请输入密码:")
print("注册成功,请登入账号")
while True:
userID=input("请输入账号:")
pwd=input("请输入密码:")
if userID==userID and pwd==pwd:
print("欢迎尊敬的"+name+"进入商店")
print("个人信息:")
print("普通会员")
print("姓名:"+name)
print("性别:"+sex)
while True:
bianhao=input("输入商品类型:“糕点”或“饮料”,输入”BUY“结算:")
if bianhao == "包点":
print("1. 蛋糕 5元")
print("2. 法式小面包 6元")
print("3. 绿豆糕 10元")
while True:
bianhao=input("输入编号购买商品,输入“B”返回类型选择:")
if bianhao=="1":
geshu=int(input("输入购买个数:"))
shoppingcar+="蛋糕"
shoppingcar+="*"
shoppingcar+=str(geshu)
shoppingcar+=" "
sum+=int(dianxin["蛋糕"])*geshu
shuliang1=str(geshu)
print("加入购物车成功")

elif bianhao=="2":
geshu=int(input("输入购买个数:"))
shoppingcar+="法式小面包"
shoppingcar+="*"
shoppingcar+=str(geshu)
shoppingcar+=" "
sum+=int(dianxin["法式小面包"])*geshu
shuliang2=str(geshu)
print("加入购物车成功")

elif bianhao=="3":
geshu=int(input("输入购买个数:"))
shoppingcar+="绿豆糕"
shoppingcar+="*"
shoppingcar+=str(geshu)
shoppingcar+=" "
sum+=int(dianxin["绿豆糕"])*geshu
print("加入购物车成功")

else:
break

if a == "饮料":
print("1. 可乐 3元")
print("2. 红茶 4元")
print("3. 啤酒 10元")
while True:
bianhao=input("输入编号购买商品,输入“B”返回类型选择:")
if bianhao=="1":
geshu=int(input("输入购买个数:"))
shoppingcar+="可乐"
shoppingcar+="*"
shoppingcar+=str(geshu)
shoppingcar+=" "
sum+=int(yinliao["可乐"])*geshu
shuliang1=str(geshu)
print("加入购物车成功")

elif bianhao=="2":
geshu=int(input("输入购买个数:"))
shoppingcar+="红茶"
shoppingcar+="*"
shoppingcar+=str(geshu)
shoppingcar+=" "
sum+=int(yinliao["红茶"])*geshu
shuliang2=str(geshu)
print("加入购物车成功")

elif bianhao=="3":
geshu=int(input("输入购买个数:"))
shoppingcar+="啤酒"
shoppingcar+="*"
shoppingcar+=str(geshu)
shoppingcar+=" "
sum+=int(yinliao["啤酒"])*geshu
print("加入购物车成功")

else:
break
elif bianhao=="BUY":
jifen=str(sum/2)
print("您购买的商品有:")
print(gouwuche)
print("您共有"+jifen+"积分")
print(str(sum)+"元")
if float(jifen)>=0.0 and float(jifen)<=10.0:
vip="普通会员"
if float(jifen)>50.0 and float(jifen)<=100.0:
vip="高级会员"
elif float(jifen)>150.0 and float(jifen)<=500.0:
vip="银钻会员"
elif float(jifen)>1000.0:
vip="金钻会员"
xinxi=input("输入“2”会员信息:")
if xinxi=="2":
print("个人信息:")
print(vip)
print("姓名:"+name)
print("性别:"+sex)
else:
print("输入错误")
else:
print("您的账号或密码有误,请重新输入")

以上是关于简单购物程序(续1)的主要内容,如果未能解决你的问题,请参考以下文章

简单电商购物程序(续1)

简单电商购物程序(续1)

简单的购物程序

一个简单的购物车程序

简单的购物车小程序

用java代码写一个简单的网上购物车程序