列表推导式 [ i*i for i in range(10)if i %2 ==0]值是_________。
A: [0, 4, 16, 36, 64]
B: [0, 4, 16, 36, 64,10]
C: [0, 10]
D: [2, 16, 36, 64]
A: [0, 4, 16, 36, 64]
B: [0, 4, 16, 36, 64,10]
C: [0, 10]
D: [2, 16, 36, 64]
举一反三
- 已知列表:L=[2, 16, 36, 64],则执行L.insert(0,10)后,L的值是________。 A: [2, 10,16, 36, 64] B: [10, 2, 16, 36, 64] C: [2, 16, 36, 64,10] D: [10, 16, 36, 64]
- 下面代码的输出结果是 ls = [] for i in range(1,11): ls.append(i**2) print(ls) A: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] B: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20,22] C: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100,121] D: [11,22,33,44,55,66,77,88,99,1010,1111]
- 下面代码的输出结果是()。 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]
- 阅读下列程序,程序输出的结果是______() bb=[16, 4, 10, 3, 6, 13]for i in range(len(bb)): if bb[i]%2==0: bb[i]=1 else: bb[i]=0print(bb.count(1),bb.count(0),sep=',')[/i][/i][/i] A: 2 4 B: 2,4 C: 4,2 D: 4 2
- 下列语句的执行结果是: for i in range(10): if i % 4 == 0: print(i) continue break A: 0 B: 2 C: 4 D: 8