Python writes a shopping cart applet

The shopping cart applet written in python can realize the functions: display the price of the product, enter the serial number of the selected product, add the products that can be purchased to the shopping cart and display the balance. When the price of the purchased product is higher than the balance, it will prompt that the purchase cannot be made. The code is as follows: 
#_author:"WangBin"
#date:2018/4/23
msg = '''
-------------Information of commodity------------ -
1.iphone8 5800
2.mac book 9000
3.coffee 32
4.python book 80
5.bicyle 1500
-------------------ending------- ------------------
'''
print(msg)
loop_falg = True #loop flag, when True, execute the loop
total_monnye = 5000
get_commodity = []
while loop_falg:
num = input('Choose your commodity number:')
num_int = int(num)
commodity_name = ['iphone8','mac book','coffee','python book','bicyle'
commodity_price = ['5800','9000','32','80','1500']
for i in range(6):
if i == num_int:
money_left = total_monnye - int(commodity_price[num_int - 1])
total_monnye = money_left
if money_left >= 0:
print("Commodity" + commodity_name[num_int - 1] + "Added to shopping cart,"
"The current remaining amount is:" + str(monney_left))
else:
print("The current balance Insufficient, please choose another product, the current balance is: ", money_left)
else:
get_commodity.append(commodity_name[num_int - 1])
get_commodity.append(commodity_price[num_int - 1])
conti_find = input('Do you want to continue shopping? y/n:') #Determine whether to continue shopping
if conti_find =='n':
loop_falg = False
print("You have purchased the following items: ",get_commodity)
print("Your balance is: "+str(monney_left)+" yuan, welcome next time")

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324689461&siteId=291194637