1 list = ((1,'iPhone X',8300),(2,'iPad Pro',4600),(3,'IBM z10',50000),(4,'Coffee',30))
2 print('Welecome to 7-11 !\n')
3 print('There are:')
4 for i in list:print(i)
5 balance = int(input('\nPlease input your balance: \n'))
6 car = [] #car[name][prix]
7 i = 0
8 while True:
9 code = input('Please input the code or input exit for exit:')
10 if code == 'exit':break
11 elif balance >= list[int(code)-1][2]:
12 code = int(code)
13 balance -= list[code-1][2]
14 car.insert(i,[i+1,list[code-1][1],list[code-1][2]])
15 i += 1
16 elif balance < list[int(code)-1][2]:
17 print('SO... !\n')
18 else:print('BIUBIUBIU')
19 for i in car:print(i)
20 print(balance)