标签:NPU pue rate ike append -- else end lis
product_list = [
(‘Iphone‘,5800),
(‘Mac Pro‘,9800),
(‘Bike‘,800),
(‘Watch‘,10600),
(‘Coffee‘,31),
(‘Alex Python‘,120)
]
shop_dist=[]
salary=input(" inpue your salary")
if salary.isdigit():
salary=int(salary)
while True:
for index,item in enumerate(product_list):
print(index,item)
user_chose=input("you yao mai ma?")
if user_chose.isdigit():
user_chose=int(user_chose)
if user_chose<len(product_list) and user_chose>0:
pie_list = product_list[user_chose]
if pie_list[1]<=salary:
print("买得起")
shop_dist.append(pie_list)
salary -= pie_list[1]
print(" add %s your pie_list and your salayy is \033[31;1m%s\033[0m" % (pie_list, salary) )
else:
print(‘就剩这点%s钱,买个毛线啊‘% salary)
else:print("ni输入的%s商品不存在" % user_chose)
elif user_chose ==‘q‘:
print(‘----------------你的购物车--------------‘)
for i in shop_dist:
print(i)
print("Your current balance:", salary)
exit()
else:
print(‘invald option‘)
标签:NPU pue rate ike append -- else end lis
原文地址:https://www.cnblogs.com/nyqxiaoqiang/p/9567320.html