Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

The Basics of range()

In the previous lesson, you learned how to iterate or loop over a collection of data in the form of a list. That was great for your small list of names, but what if you want to generate a list of numbers? To do that, you can use the built-in range function.

There are three ways you can call range():

  1. range(stop) takes one argument.
  2. range(start, stop) takes two arguments.
  3. range(start, stop, step) takes three arguments.

Comments & Discussion

Become a Member to join the conversation.