'typeerror: 'function' Object Is Not Subscriptable' In Python 3.4.3?
I have a food menu and the stock and prices are in separate dictionaries. Food Stock: Food_Stock = { 'Chips' : 15, 'Bagels' : 27, 'Cookies' : 25}#Food Stock. Food Pric
Solution 1:
'function' object is not subscriptable
means you're doing something like this:
def foo(): pass
something = foo[1]
What this means is that either Food_Prices
or Food_Stock
is actually a function rather than a variable. It should be easy to figure out which, by adding as simple print statement before the line that is causing the error.
print(Food_Prices, Food_Stock)
Most likely this is because you have a function somewhere else in your code named either Food_Prices
or Food_Stock
, or you've reassigned the value of one of those variables.
Post a Comment for "'typeerror: 'function' Object Is Not Subscriptable' In Python 3.4.3?"