Calendar List Indices Error

Hello Everyone,

I need some help resolving an error in the calendar skill path project I have been working on. I can start the program, but I can a data type error when I try and add an event to the calendar: TypeError: list indices must be integers, not str. I know from the error that the key is taking on a string format when it should be an integer format, but I cannot figure out why. As far as I can tell I have entered the code (minus the user prompt text) exactly as it is in the walkthrough.

The error is on line 44 of the editor in my gist.

Can anyone offer me some guidance?

Have a look at that line for the point where you index a list. What type are you using to index that list? If you’re not 100% sure from looking at your code consider using something like print to tell you something about the object; the type function may be useful.

Well I feel foolish, thank you for the help. This solved my problem!

Learning your way around debugging is useful, but until you start digging around it can be unclear (after the hundredth time you make a mistake you’ll know the errors well :laughing:). Python’s errors are often fairly decent though so read them carefully and then start testing things nearby with print (or fancier debugging tools) should you need to.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.