假设线性表list1=[1,2,5]和list2=[2,3,6].代码list1.addAll(list2)执行后,list2是__________.
A: [1,2,2,3,5,6]
B: [1,2,3,5,6]
C: [1,5]
D: [2]
E: [2,3,6]
A: [1,2,2,3,5,6]
B: [1,2,3,5,6]
C: [1,5]
D: [2]
E: [2,3,6]
举一反三
- 假设线性表list1=[1,2,5]和list2=[2,3,6].代码list1.addAll(list2)执行后,list1是__________. A: [1,2,2,3,5,6] B: [1,2,3,5,6] C: [1,5] D: [2]
- 假设列表list1是[1, 2, 5]、列表list2是[2, 3, 6],执行list1.addAll(list2)后,list2是
- 执行下列代码后,变量list2的值将改变为哪个选项?[br][/br] list1 = [1, 2, 3] list2 = [] for element in list1: list2.append(element) list1 = [4, 5, 6] A: [1, 2, 3] B: [4, 5, 6] C: [1, 2, 3, 4, 5, 6] D: 没有;该代码无效
- 若有List=[2,5,1,7],执行语句List.insert(3,9),List中的值为_______。() A: [9, 2, 5, 1, 7] B: [2, 5, 1, 9, 7] C: [2, 5, 1, 7, 9] D: [2, 5, 1, 7, 3, 9]
- 假设ls1=list("python")且ls2=["1","2","3"],执行ls1[2:]=ls2,则len(ls1)是( )。 A: 3 B: 5 C: 6 D: 9