commodity_list=[('bicycle',9000),('iphone',20000),('tesla',20000),('python book',109),('mac book',2000)]
deposit=input('please input your budget:')
if deposit.isdigit():
deposit=int(deposit)
purchase_item=[]
while True:
for i,v in enumerate(commodity_list,1):
print(i,'----',v)
choice=input('input your choice Commodity No【Quite:q]')
if choice.isdigit():
choice=int(choice)
p_item=commodity_list[choice]
if deposit>p_item[1]:
print('your choice is %s,your balance is %s'%p_item,deposit)
purchase_item.append(p_item)
deposit-=p_item[1]
elif choice=='q':
print('------your list---------')
for i in purchase_item:
print(i)
print('your balance is %s',%deposit)
break
else:
print('please input right Commodity No')
else:
print('invalid string literal')