Next, you’ll focus on enumerate()
, another key tool for looping in Python.
These lessons are part of a Real Python video course by Philipp Acsany.
Next, you’ll focus on enumerate()
, another key tool for looping in Python.
These lessons are part of a Real Python video course by Philipp Acsany.
00:00
Welcome to Python enumerate(): Simplify Looping With Counters. I’m Philipp from Real Python, and today I want to show you how the enumerate()
function helps you to count in for
loops.
00:13 Most calendar-based methods use a four-season model to identify the warmest and the coldest seasons, summer and winter, and in between, spring and fall.
00:23
Why am I talking about seasons? Well, in this course, we’ll work with a list of seasons: Spring
, Summer
, Fall
, and Winter
.
00:30
And your task is to create a Python script to count them. In the end, output should look like this: 1 Spring
, 2 Summer
, 3 Fall
, 4 Winter
.
00:43
First, you will do this without the enumerate()
function. Then you will use it. In lesson number three, you will learn what this enumerate()
function actually is, and then you will use this knowledge to rebuild it. Finally, you will see your very own enumerate()
function in action. All right, let’s get started.
You must own this product to join the conversation.