January 2019
Beginner
318 pages
8h 23m
English
The Python range() function will generate a sequence of numbers. For example, range(10) will generate numbers from 0 to 9 (10 numbers).
We can also define the start, stop, and step size as parameters and range() will be as follows:
range(start, stop, step size).Step size defaults to 1 if not provided.For loop example using range() function:
Let's take a look at an example:
for i in range(5): print("The number is", i)Output:The number is 0The number is 1The number is 2The number is 3The number is 4
Read now
Unlock full access