Day 3 EX 购物车自写

# -*- coding: utf_8 _*_
# Author:Vi
import copy
goods = [0,[1,'iphone',20],[2,'ipad',2500]]
salary = int(input("Please tell me your salary:"))
list = ['My list:']
count = 0
while count< 1:
good_good = copy.deepcopy(goods)
print(goods[1:])
n = int(input("Tell me your thing's ID:"))
if good_good[n][2] > salary:
print("You have not enough money~")
break
elif good_good[n][2] < salary:
print("Yeap,you have brought it!")
salary = salary - good_good[n][2]
list = list + good_good[n]
refree = input("Do you wang to buy something more?Please tell me yes or no.")
if refree == 'yes':
continue
else:
print(list)
print("I still have",salary,"yuan")
break
啊,Yeah!

猜你喜欢

转载自www.cnblogs.com/arnold2029/p/10699049.html
ex3