题目内容

range(3) creates a sequence of which numbers?

A. [1,2,3]
B. [0,1,2,3]
C. [0,1,2]
D. [1,2]

查看答案
更多问题

range(2,5) creates a sequence of which numbers?

A. [0,2,4]
B. [2,3,4,5]
C. [2,3,4]
D. [2,4]

range(1,20,8) creates a sequence of which numbers?

A. [0,8,16]
B. [1,9,17]
C. [0,8,16,24]
D. [1,9,17,25]

What does arr[-2] return given the array ‘arr = [2,4,6,8,10]’?

A. 2
B. 4
C. 6
D. 8
E. 10
F. Index out of bounds error

Which of the following commands gives us all even numbers from the array ‘arr = [0,1,2,…,10]?

A. [x for x in arr if x%2==0 in arr]
B. [2*x for x in arr if x<6 in arr]
C. Both are correct

答案查题题库