码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-05-29 09:18:42      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:返回   vivo   while   info   put   技术   购物车   inpu   vip   

sum = 0
gouwuche = ""
shuliang = 0
shouji = {"oppo": 1000, "vivo": 1200, "xiaomi": 1499}
shuiguo = {"苹果": 7, "山竹": 25, "蓝莓": 30}

userku = ""
psdku = ""
nameku = {}
sexku = {}
jifen = "0"
vip = ""

a = input("请输入”1”创建账号:")
if a == "1":
nameku = input("请输入姓名:")
sexku = input("请输入性别:")
userku = input("请输入账号:")
psdku = input("请输入密码:")
print("注册成功,请登入账号")
while True:
user = input("请输入账号:")
psd = input("请输入密码:")
if user == userku and psd == psdku:
print("欢迎尊敬的" + nameku + "进入商店")
print("个人信息:")
print("普通会员")
print("姓名:" + nameku)
print("性别:" + sexku)
while True:
a = input("输入商品类型:“手机”或“水果”,输入”BUY“结算:")
if a == "手机":
print("1. oppo 1000元")
print("2. vivo 1200元")
print("3. xiaomi 1499元")
while True:
a = input("输入编号购买商品,输入“B”返回类型选择:")
if a == "1":
geshu = int(input("输入购买个数:"))
gouwuche += "oppo"
gouwuche += "*"
gouwuche += str(geshu)
gouwuche += " "
sum += int(shouji["oppo"]) * geshu
shuliang1 = str(geshu)
print("加入购物车成功")

elif a == "2":
geshu = int(input("输入购买个数:"))
gouwuche += "vivo"
gouwuche += "*"
gouwuche += str(geshu)
gouwuche += " "
sum += int(shouji["vivo"]) * geshu
shuliang2 = str(geshu)
print("加入购物车成功")

elif a == "3":
geshu = int(input("输入购买个数:"))
gouwuche += "xiaomi"
gouwuche += "*"
gouwuche += str(geshu)
gouwuche += " "
sum += int(shouji["xiaomi"]) * geshu
print("加入购物车成功")

else:
break

if a == "水果":
print("1. 苹果 7元")
print("2. 山竹 25元")
print("3. 蓝莓 30元")
while True:
a = input("输入编号购买商品,输入“B”返回类型选择:")
if a == "1":
geshu = int(input("输入购买个数:"))
gouwuche += "苹果"
gouwuche += "*"
gouwuche += str(geshu)
gouwuche += " "
sum += int(shuiguo["苹果"]) * geshu
shuliang1 = str(geshu)
print("加入购物车成功")

elif a == "2":
geshu = int(input("输入购买个数:"))
gouwuche += "山竹"
gouwuche += "*"
gouwuche += str(geshu)
gouwuche += " "
sum += int(shuiguo["山竹"]) * geshu
shuliang2 = str(geshu)
print("加入购物车成功")

elif a == "3":
geshu = int(input("输入购买个数:"))
gouwuche += "蓝莓"
gouwuche += "*"
gouwuche += str(geshu)
gouwuche += " "
sum += int(shuiguo["蓝莓"]) * geshu
print("加入购物车成功")

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

技术图片

 

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

标签:返回   vivo   while   info   put   技术   购物车   inpu   vip   

原文地址:https://www.cnblogs.com/WangWeiXiong/p/10941690.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!