题目3单选题
What will be the output of the following Python code? >>> s=["pune", "mumbai", "delhi"] >>> [(w.upper(), len(w)) for w in s]A. [('PUNE', 4), ('MUMBAI', 6), ('DELHI', 5)]B. ErrorC. [PUNE, 4, MUMBAI, 6, DELHI, 5]D. ['PUNE', 4, 'MUMBAI', 6,'DELHI', 5]
题目5单选题
Suppose list1 is [1, 3, 2], What is list1 * 2A. [1, 3, 2, 3, 2, 1]B. [2, 6, 4]C. [1, 3, 2, 1, 3]D. [1, 3, 2, 1, 3, 2]
题目6单选题
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], which output of the following choices is correctA. >>> numbers[0::3] [1, 3, 5, 7, 9]B. >>> numbers[: -1] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]C. >>> numbers[0: 2] [1, 2, 3]D. >>> numbers[-2:] [9, 10]
题目8单选题
What will be the output of the following Python code? a=[13,56,17] a.append([87]) a.extend([45,67]) print(a)A. [13, 56, 17, 87,[ 45, 67]]B. [13, 56, 17, 87, 45, 67]C. [13, 56, 17, [87], [45, 67]]D. [13, 56, 17, [87], 45, 67]
题目10单选题
What will be the output of the following Python code? lst=[3,4,6,1,2] lst[1:2]=[7,8] print(lst) lst[3]=[9,10] print(lst)A. [3, 7, 8, 6, 1, 2] [3, 7, 8, [9, 10], 1, 2]B. Syntax errorC. [3,[7,8],6,1,2] [3, 7, 8, 9, 10, 1, 2]D. [3,4,6,7,8] [9,10,4,6,7,8]