Answer:1. range(1,10,2) - 1 to 9 with a gap of 2 numbers each so it yields - 1,3,5,7,9 2. [-2,-4,-6,-8,-10] - range(-2,-11,-2) 3. (i) range(4,20)[2:5] - Generates the list of number…
example: 1.What sequence of numbers is equivalent to the given ranges?
range(1,10,2)
2.Express the following as a range.
[-2,-4,-6,-8,-10]
3.What do each of these expressions yield?
(1) range(4,20)[2:5] (2) list(range(10,60,4)[-2:1:-4] (3) range(3,12,4)[2]
(4) range(0,9,2)[:] (5) range(2,20)[-2:-10:-1] (6) range(3,18,2)[::2]
(7) range(1,33,6)[1::2] (8)range(-5,20,3)[-8:5:2]