题目1单选题
Review this code snippet: new_list = [1, 2, 3, 4, 5, 6, 7, 8, 9] print(new_list[1::2]) What will Python print when you execute this codeA. [2, 4, 6, 8]B. NoneC. [1, 2]D. [1, 3, 5, 7, 9]
题目2单选题
Is the following Python code valid? >>> a=2,3,4,5 >>> aA. Yes, 2 is printedB. Yes, (2,3,4,5) is printedC. Yes, [2,3,4,5] is printedD. No, too many values to unpack
题目4单选题
What is the output of the following piece of code? a=list((45,)*4) print((45)*4, a)A. Syntax errorB. 180 [45,45,45,45]C. 180 [(45),(45),(45),(45)]D. (45,45,45,45) [45,45,45,45]
题目6单选题
Suppose list1 is [1, 3, 2], What is list1 * 2A. [1, 3, 2, 3, 2, 1]B. [1, 3, 2, 1, 3, 2]C. [1, 3, 2, 1, 3]D. [2, 6, 4]
题目9单选题
a = [1,2,3] b = (a,a) b[0][1] = 100 print(a,b) 上面程序输出结果是A. [1 ,100 ,3] ([1,100,3], [1, 100, 3])B. [1 ,2 ,3] ([1,100,3], [1, 2, 3])C. [1 ,2 ,3] ([1,100,3], [1, 100, 3])D. 程序有错,无法运行
题目10单选题
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], which output of the following choices is correctA. >>> numbers[0: 2] [1, 2, 3]B. >>> numbers[0::3] [1, 3, 5, 7, 9]C. >>> numbers[-2:] [9, 10]D. >>> numbers[: -1] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]