Python Range Exercises

Let’s check out some exercises that will help understand range() function better.

Exercise 14-a

Create a range from 0 to 50, excluding 50.


range() function can be used to create range type data.

rng = range (50)
or rng = range(0,50)

Exercise 14-b

Create a range from 0 to 10 with steps of 2.


range() function can take 3 parameters. range(start, stop, step)

rng = range(0,10,2)

Need More Exercises?

Check out Holy Python AI+ for amazing Python learning tools.

*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.
Umut Sagir
Finance & Data Science Professional,
Founder of HolyPython