TypeError: ‘function’ object is not subscriptable – Python

You have two objects both named bank_holiday — one a list and one a function. Disambiguate the two.

bank_holiday[month] is raising an error because Python thinks bank_holiday refers to the function (the last object bound to the name bank_holiday), whereas you probably intend it to mean the list.

Leave a Comment