112k views
14 votes
What is the range?
-2 -4 -4 -2 3 5

User LuisPinto
by
5.1k points

2 Answers

8 votes

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]

User Brian Noguchi
by
5.3k points
0 votes

Answer:

9

Explanation:

you do the max- min. so 5-(-4) which is really 5+4=9

User Kyriog
by
5.9k points