Looping With Python enumerate() (Summary)
This course covered how and why to use enumerate()
. You learned how to:
- Use
enumerate()
to get a counter in a loop - Apply
enumerate()
to display item counts - Implement your own equivalent function to
enumerate()
- Unpack values returned by
enumerate()
For more information on concepts covered in this course, you can check out:
- Python
for
Loops (Definite Iteration) - Defining Your Own Python Function
- Sets in Python
- Lists and Tuples in Python
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00
Congratulations! You finished a Python enumerate()
course, and you did quite some things. First, you explored how it is to iterate without the enumerate()
function, and then you used it, and you hopefully learned a little bit about it and why the enumerate()
function is useful.
00:21
Then you built your own enumerate()
function, my_enum()
, to get a little bit a feeling of what’s happening under the hood of enumerate()
.
00:30
And you tried it out by using the my_enum()
function. Python’s enumerate()
lets you write Pythonic for
loops when you need a count and the value from an iterable.
00:42
The big advantage of enumerate()
is that it returns a tuple with a counter and a value. So you don’t have to increment the counter yourself, and it gives you the option to change the starting value for the counter.
00:54
This is something that you explored by building your own enumerate()
function.
01:00
And that concludes Python enumerate()
: Simplify Looping With Counters! With enumerate()
, you now can count seasons, no matter how many there are.
Become a Member to join the conversation.