Can't figure out how to work with list indexes

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:


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 That means the i in if d == comp[i] is a string