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 Sequences!
You have completed Python Sequences!
Preview
Another iteration technique that Pythonistas can use is iterating with ranges.
This video doesn't have any notes.
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
Ranges are how we iterate
over numbers in Python.
0:00
They're commonly used when you wanna
repeat a behavior a certain number
0:00
of times.
0:03
But this behavior's not necessarily
tied to elements of a sequence.
0:04
In fact, iterating over Python ranges is
very analogous to the traditional for
0:07
loops you'll find in other
programming languages.
0:11
Let's say we wanted to have a for
loop that loops ten times.
0:14
Knowing what you know so
far about iteration,
0:17
you might try something like this.
0:20
Let's see what happens when I run this.
0:28
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