#Loops Exercises Part 1: Exploring Range Do the following exercises in the Python interpreter.
You do not need to type up answers to these.
- Type
range(5)
and press enter. What happens? - Type
range(3.14)
and press enter. What happens? - Type
range(-8)
and press enter. What happens? - Type
range(0)
and press enter. What happens? - Type
range(1)
and press enter. What happens? - Type
range(1,5)
and press enter. What happens? - How is this different than
range(5)
? - Type
range(5,1)
and press enter. What happens? - Now type
range(5,1,-1)
and press enter. What happens? - How is this different than
range(5,1)
? - Type
range(0,-5)
and press enter. What happens? - Type
range(-5,0)
and press enter. What happens? - How is this different than
range(0,-5)
? - How would you get the numbers from 0 down to -4? (Hint: look at #8)
- Type
range(10)
and press enter. What happens? - Type
range(0,10)
and press enter. What happens? - Type
range(0,10,1)
and press enter. What happens? - Type
range(0,10,2)
and press enter. What happens? - Type
range(0,10,1+1)
and press enter. What happens?
Please record your answers to these questions by using the edit button on GitHub.
Make sure you have pushed your lists exercises before making any commits on GitHub, otherwise you will have to make a merge commit later.
- What does
range
do with a single argument?
- [Your answer here]
- What do the arguments mean if there are 2?
- [Your answer here]
- What does the third argument mean?
- [Your answer here]