习题-购物车

salaryint(input("please input your salary:"))
shopping_car = []
Commodity_shelves = [["iphone",5800],["macbookpro",12000],["starbuck_latte",30],["Alex_python",81],["bike",800]]
j = 0
 
 
    if salary < price:
        print("你的余额不足")
        print("你的购物车中已添加以下商品:", shopping_car)
        break
    elif buy == 100:
        break
    else:
        shopping_car.append(Commodity_shelves[buy][0])
        salary -= price
        print("你的购物车中已添加以下商品:",shopping_car)
        print("你的余额为:", salary)
    j = 0

猜你喜欢

转载自www.cnblogs.com/nickkkk/p/8940716.html