Functions of enumerate and eval

enumerate

Have we ever needed to loop over a list and also needed to know where in the list we were at? We could add a counter that we increment as we loop, or we could use Python’s built-in enumerate function!

Example of enumerate() with a string

Let’s try it out on a string!

Get hands-on with 1400+ tech skills courses.