Я не могу понять, почему я получаю эту ошибку: если type (location [choice [c]]) == int и location [choice [c]]% 3 == 0: TypeError: объект int не является subscriptable
Я не понимаю, что означает ошибка.
Мой код:
candy = ["Hi-Chew",10,200, 'Gummy bear',8,200, 'skittles',11,200, 'Mint',13,200,
'Cadbury',10,200,]
bakedGood= ['Bread (Whole Wheat)',10,200, 'White bread',10,200, 'Baguette',15,200, 'Cheese
Bread',12,200, 'sausage bun',13,200]
meat = ['Chicken nuggets (12 peices)',10,200, 'BBQ wings (6 pc)',15,200, 'Pizza meat-eater (10
cm radius)',40,200, 'Cheeseburger',15,200, 'Chicken Breast',25,200]
savouryVeg = ['pizza (veg)',45,200, 'Salad',20,200, 'Fries',10,200,'veg
burger',20,200,'Naan',12,200]
bakedSw = ['Strawberry cake',50,50, 'Chocolate cake',50,50, 'Chocolate cupcake',15,100,'Glazed
donut',10,200, 'Chocolate donut',10,200,]
location = [candy,bakedGood,meat,savouryVeg,bakedSw]
categories = ['Candy', 'Baked Goods', 'Meat', 'Veg', 'Baked sweets']
def menu ():
order = ''
for i in range (1,len(categories)):
print(str(i+1)+".", categories[i])
choice = int(input("Choose a category by typing the number beside the categories name."))
print("Items in this list are")
print("%-10s%-17s"%('Item name', 'Price'))
for c in range (len(location[choice])):
if type(location[choice[c]]) == int and location[choice[c]] % 3 == 0:
print("%-10s%-17s"%(location[choice[c]], location[choice[c+1]]))