range()Easy Examples

Generates an immutable sequence of integers

Basic range() usage

Simple demonstration of the range() built-in function.

python
for i in range(5):
    print(i)
print(list(range(2, 10, 2)))

range() is a built-in function that generates an immutable sequence of integers.

range() with different inputs

Calling range() with various argument types.

python
# More range() examples
print("range() is a Python built-in function")
print(f"Type: {type(range)}")

range() accepts different types of arguments and produces corresponding results.

Want to try these examples interactively?

Open Easy Playground