下面代码的输出结果是
list1 = []
for i in range(1,11):
list1.append(i**2)
print(list1)
list1 = []
for i in range(1,11):
list1.append(i**2)
print(list1)
举一反三
- 下面代码的输出结果是 list1=[] foriinrange(1,11): list1.append(i**2) print(list1) A: [1,4,9,16,25,36,49,64,81,100] B: [2,4,6,8,10,12,14,16,18,20] C: 错误 D: ----Python:----ASuperlanguage
- 下面代码的输出结果是()。 list1<br/>= []<br/>for<br/>i in range(1,11):<br/>list1.append(i**2) print(list1) A: [1,<br/>4, 9, 16, 25, 36, 49, 64, 81, 100] B: ----Python:----A<br/>Superlanguage C: 错误 D: [2,<br/>4, 6, 8, 10, 12, 14, 16, 18, 20]
- 代码如下 #函数定义 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']
- 给出下面代码:a= input( ).split( , )if isinstance(a,list):print( {} is list .format(a))else:print( {} is not list .format(a))代码执行时,从键盘获得1,2,3,则代码的输出结果是:() A: A 执行代码出错 B: 1,2,3 is not list C: ['1', '2', '3'] is list D: 1,2,3 is list
- 下面代码的输出结果是() vlist = list(range(5)) print() A: [0, 1, 2, 3, 4] B: 0;1;2;3;4; C: 0,1,2,3,4, D: 0 1 2 3 4