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

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Advanced Uses of range()

Give Feedback

So far, you’ve seen how you can use the range function to generate a list of integers. It might appear that using range() in a for loop is equivalent to using a list of incrementing or decrementing values, but that’s not the case. There are some important similarities and differences. range() is its own class in Python:

>>>
>>> type(range(3))
<class 'range'>

range isn’t a list, but it dynamically manages a list in memory.

Comments & Discussion

Become a Member to join the conversation.