TOPIC 6: Python range ( )

5. Displaying a Range

A range object is not displayed directly as a normal list.

To display all the values, convert it into a list using the list() function.

Example:

print(list(range(5)))

Output:

[0, 1, 2, 3, 4]

Example:

print(list(range(1, 6)))

Output:

[1, 2, 3, 4, 5]

Example:

print(list(range(5, 20, 3)))

Output:

[5, 8, 11, 14, 17]