Can't figure out how to work with list indexes
Gamarleton

I'm trying to reference an element in a list and return the next element in the list as a string.
But it keeps telling me it's the wrong syntax.

I've looke the syntax up too, and all I could find was to write it like this:

listName[indexNumber]

But I just get SyntaxError: invalid syntax

Edit: I realized my [email protected]** had forgotten a :.
Now, I instead get: TypeError: list indices must be integers or slices, not str
I don't know how to do this.

You are viewing a single comment. View All
Gamarleton

@MrVoo
Well if you read my Edit, I now have a TypeError, I feel like the "Learn Python the Right Way" pdf is either full of overclass exercises, or very lacking of actual information on how to do specific things they ask us to in said exercises.