print([i for i in range(11) if i >; 4])
举一反三
- print([i for i in range(5)]) A: [0,1,2,3,4,5] B: [0,1,2,3,4] C: [1,2,3,4,5] D: i
- for i in range(4): if i%2==0: print(i) break print(i) 结果是
- 已知 vec=[[1,2],[3,4]],则表达式[[row[i] for row in vec] for i in range(len(vec[0]))]的值为( )[/i]
- 下面代码的输出结果是: 。ls = [[1,3,6],[4,6,3],[2,8,5]]sum1,sum2 = 0,0for i in range(3):sum1 = sum1 + ls[i][i]sum2 = sum2 + ls[i][2-i]print("sum1={},sum2={}".format(sum1,sum2))[/i][/i][/i]
- 已知列表lst=[1,2,3],则分别执行以下代码,结果为[1,4,9]的是: A: for i in lst: i=i**2print(lst) B: for i in range(0,3): lst[i]**=2print(lst) C: for i in range(0,3): lst[i]=i**2print(lst) D: for i in range(0,3): lst[i]+=lst[i]print(lst)