Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introducing Lists!
You have completed Introducing Lists!
Preview
Let's iterate through each value in your list.
Code
video_games = [
"The Legend of Zelda: Breath of the Wild",
"Splatoon 2",
"Super Mario Odyssey",
]
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
iterate through every item.
0:00
Now, typically we iterate
through each value and
0:00
then run some code against that item.
0:03
Now, the most common way to do
this is with a for-in loop.
0:05
We can use the for-in loop
because the list is iterable.
0:09
That is, it's able to be iterated.
0:13
Let's take a look at this
ability in the REPL.
0:15
Okay, so let's take a look at this
meeting.py file in interactive mode.
0:19
So we'll kick this off,
python -i meeting.py.
0:24
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up