标签:out [1] ror ast [] mat pam tin index
list = [('iphone',12000),('iwatch',4200),('book',45),('water',3)]
shopp = []
money = input('input your money:')
if money.isdigit():
money = int(money)
while True:
for index,i in enumerate(list):
print(index+1,i)
pamage = input('input shop number:')
if pamage.isdigit():
pamage = int(pamage)
if pamage > 0 and pamage <= len(list):
if pamage > len(list):
print('your num is out')
else:
if list[pamage - 1][1] <= money:
money = money - list[pamage - 1][1]
print('------------------------------------------------')
print('your buy shop is \033[32;1m{shop}\033[0m,and your will out \033[31;1m{Money}\033[0m,and your money stay \033[42;1m{stay}\033[0m'.format(shop =list[pamage-1][0],Money=list[pamage-1][1],stay=money))
print('------------------------------------------------')
shopp.append(list[pamage-1][0])
else:
print('your money not inf')
elif pamage > len(list):
print('your number outing')
elif pamage.lower() == 'q':
for p in shopp:
print('thid id your shop:\033[34;1m{0}\033[0m'.format(p))
print('your money last \033[41;1m{0}\033[0m'.format(money))
exit()
else:
print('input error,please checking')
else:
print('please input number')
标签:out [1] ror ast [] mat pam tin index
原文地址:https://www.cnblogs.com/Arthur7/p/9760800.html