TOPIC 6: Python range ( )

3. Calling range() with Three Arguments

When three arguments are provided:

  • The first argument is the start value.

  • The second argument is the stop value.

  • The third argument is called the step value.

The step value determines how much each number increases.

If the step value is not provided, Python uses 1 by default.

Example:

x = range(3, 10, 2)

print(list(x))

Output:

[3, 5, 7, 9]

The numbers increase by 2 each time.