The Python range() Function: Overview
Python’s built-in range
function is handy when you need to perform an action a specific number of times. As an experienced Pythonista, you’ve most likely used it before. But what does it do?
By the end of this course, you’ll:
- Understand how the Python
range
function works - Know how the implementations differ in Python 2 and Python 3
- Have seen a number of hands-on
range()
examples - Be equipped to work around some of its limitations
Let’s get cracking!
00:00
Hi! This is Austin Cepalia with realpython.com. In this course, we’re going to learn all about Python’s built-in range()
function.
00:10
I like to think of built-in functions, like range()
, as some of the fundamental building blocks of Python programs. They make performing common tasks as simple as, well, calling a function! And because they are global functions, they are always available to us. By the end of this course, you’ll be comfortable using the range()
function within your own Python programs.
00:37
We’ll start by learning about the basics of the range()
function and how we can use it with definite iteration in the Python for
loop.
00:46
We’ll learn about the three different implementations of the range()
function, which will allow you to customize the output it generates. Finally, we’ll take a look at some advanced range()
topics, and I’ll warn you about some of its limitations. Let’s get started.
Become a Member to join the conversation.