Functional Requirements:
Require users to enter total assets, for example: 2000
Display the list of items, let the user select the item according to the serial number, add the shopping cart
Purchase, if the total amount of goods is greater than the total assets, indicating that the account balance is insufficient, otherwise, the purchase succeeds.
Add: Can recharge, a product to remove the shopping cart
goods = [
{"Name": "Computer", "Price": 1999},
{"Name": "Mouse", "Price": 10},
{"Name": "Yacht", "Price": 20},
{"Name": "Beauty", "Price": 998},
]
goods = [
{"name": "Computer", "Price": 1999},
{"name": "Mouse", "Price": ten},
{"name": "Yacht", "Price": 20 },
{"name": "Beauty", "Price": 998},
]
zzc = int (input (' Please enter total assets: '))
car = []
while True:
for I1 in EN Umerate (Goods):
Print (i1[0],i1[1].get (' name '), I1[1].get (' price '))
ret = int (input (' Please select an item according to the ordinal, exit input 88: ')) br> for I2 in Enumerate (goods):
If i2[0] = = ret:
Car.append (Goods[ret])
Print ( CAR)
If ret = =:
for i3 in car:
ZJ = 0
ZJ = i3[' price ' + ZJ
If ZJ > ZZC:
# Print (' Insufficient balance, please recharge ')
XZ = input (' Insufficient balance, select recharge input y, exit purchase input N: ')
if xz = = ' Y ':
JJ = int (input (' Please enter recharge amount: ')
Zzc = JJ + ZZC
else:
Print (' Welcome next visit ')
Else:
Print (' buy success ')
BR Eak
Shopping cart There are some questions behind the Python job please God help to perfect it, thank you ha