Wednesday, 15 July 2015

TypeError: 'function' object is not subscriptable - Python -


I have tried to resolve the assignment with this code:

  bank_holiday = [1, 0, 1, 1, 2, 0, 0, 1, 0, 0, 0, 2] # List of bank holidays in each month Bank_Haldila (month): Month - = 1 # months, months Not to start at 1 (January) 0. There is no month Print (Bank_Holiday [month]) Bank_Holiday (int (input ("Which month you want to check:")))  

But when I run it, I get an error :

  typeError: The 'function' object is not subscriptable  

I do not know where it is coming from ...

You have the name of both objects bank_holiday - a list and a function

Bank_Holda [month] is taking an error Onki Python thinks that Bank_hilliad refers to the function (last item attached to the name Bank_hilliad ), while you may wish to mean means the list.


No comments:

Post a Comment