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 Python Basics!
You have completed Python Basics!
Preview
For loops work their way over an iterable. Learn how to use them
Learn More
- Python Wiki - ForLoop (Immerse yourself, don't worry about understanding it all!)
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
There's another type of looping
that I'd like to show off here.
0:00
And it's for when you want to
iterate through a set of values.
0:00
For instance,
think back to our banner example,
0:04
that we used to talk about strings.
0:06
And we can actually loop over
each letter in this banner.
0:08
We can say for each letter in this banner,
run some code.
0:12
Hey, let's do that in the shell here.
0:16
I'll set up the banner object.
0:18
Banner equals Happy birthday.
0:21
So, the keyword is for and
we're gonna say letter in banner.
0:27
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