A: ('a', 2)
B: ['a']
C: ['a', 2]
D: ['a', 'b']
举一反三
- list=[1,2,3],list[-1]的值为() A: 1 B: 3 C: 2 D: []
- dict={'a':1, 'b':2, 'c':3} str=list(dict.keys())[list(dict.values()).index(2)] print(str) 输出结果是( ) A: a B: C: c D: 2
- 代码如下 #函数定义 def chanageList(list): list.append(" end") print("list",list) #调用 strs =['1','2'] chanageList() print("strs",strs) 下面对 strs 和 list 的值输出正确的是 A: strs ['1','2'] list ['1','2'] B: strs ['1','2','end'] list ['1','2','end'] C: list ['1','2','end'] strs ['1','2','end'] D: list ['1','2','end'] strs ['1','2']
- 函数如下 defchanageList(list): list.append("end") print("list",list) #调用 strs=['1','2'] chanageList(strs) print("strs",strs) 下面对strs和list的值输出正确的是()。 A: strs list B: strs['1','2'] list['1','2'] C: list['1','2',’end’] strs['1','2',’end’] D: 运行运行有错误
- 补全代码,使输出结果为True Truea = 1b = "2"list = [1,2,3,4,5]print(a _____ list,b ____ list)
内容
- 0
程序段如下: x=[1,2,3] y=["a","b","c"] print(list(zip(x,y)))print函数输出的结果是( ) A: [( 'a':1), ('b:2), ('c':3)] B: [(1,2,3),("a","b","c")] C: [(1, 'a'), (2, 'b'), (3, 'c')] D: [{1:'a'}, {2:‘b'}, {3:'c'}]
- 1
下面程序的运行结果为()def swap(list): temp=list[0] list[0]=list[1] list[1]=templist=[1,2]swap(list)print(list) A: [1,2] B: [2,1] C: [1,1] D: [2,2]
- 2
请写出下列语句的运行结果:>>>list=['a','b','c','d']>>>print(list[1:3])
- 3
如下程序的输出结果是:L1 =[‘abc’, [‘123’,‘456’]]L2 = [‘1’,‘2’,‘3’]print(L1 >; L2) A: False B: TypeError: ‘>;’ not supported between instances of ‘list’ and ‘str’ C: 1 D: True
- 4
以下程序的输出结果是: L1 =['abc', ['123','456']] L2 = ['1','2','3'] print(L1 > L2) A: TypeError: '>' not supported between instances of 'list' and 'str' B: False C: True D: 1