现有a = [1, 2, 3, 4],则a[::-1]的值是多少?
A. [1, 2]
B. [1, 2, 3]
C. [1, 2, 3, 4]
D. [4, 3, 2, 1]
查看答案
现有a = [1, 2, 3, 4, 5],则a[-4: -1: 2]的值是多少?
A. [1, 2]
B. [1, 3]
C. [2, 4]
D. [2, 5]
假设列表对象aList的值为[3, 4, 5, 6, 7, 9, 11, 13, 15, 17],那么切片aList[3:7]得到的值是( )。
A. [5, 6, 7, 9]
B. (5, 6, 7, 9)
C. (6, 7, 9, 11)
D. [6, 7, 9, 11]
现有a = [1, 2, 3, 4, 5],执行 a[:0] = "abc"后,a列表的内容变成什么?
A. ['a', 'b', 'c', 1, 2, 3, 4, 5]
B. ['abc', 2, 3, 4, 5]
C. ['a', 2, 3, 4, 5]
D. [2, 3, 4, 5]
已知 x = [3, 5, 7],那么执行语句 x[1:] = [2]之后,x的值为( )。
A. [3,2]
B. [3,5,2]
C. [3,5,7]
D. [3,5,7,2]