Python "range" Flashcards

 

card 1 of 11

 

range(5)

 

Python 2 and Python 3 are different

Python 2: [0,1,2,3,4]
Python 3: range(0,5)

card 2 of 11

 

type(range(5))

 

Python 2 and Python 3 are different

Python 2: <type 'list'>
Python 3: <class 'range'>

card 3 of 11

 

range(0)

 

Python 2 and Python 3 are different

Python 2: [ ]
Python 3: range(0,0)

card 4 of 11

 

range(3)==[0,1,2]

 

Python 2 and Python 3 are different

Python 2: True
Python 3: False

card 5 of 11

 

3 in range(3)

 

Python 2 and Python 3 agree

False

card 6 of 11

 

2 in range(3)

 

Python 2 and Python 3 agree

True

card 7 of 11

 

range(10,15)

 

Python 2 and Python 3 are different

Python 2: [10,11,12,13,14]
Python 3: range(10,15)

card 8 of 11

 

range(10,40,5)

 

Python 2 and Python 3 are different

Python 2: [10,15,20,25,30,35]
Python 3: range(10,40,5)

card 9 of 11

 

range(10,39,5)

 

Python 2 and Python 3 are different

Python 2: [10,15,20,25,30,35]
Python 3: range(10,39,5)

card 10 of 11

 

range(10,2,-3)

 

Python 2 and Python 3 are different

Python 2: [10,7,4]
Python 3: range(10,2,-3)

card 11 of 11

 

30 in range(10,10+5*(9-4))

 

Python 2 and Python 3 agree

True

 

End of Problem Set

(use browser reload to restart this problem set)