Python 表达式[i for i in range(5) if i%2!=0]的值为__1__,[i**2 for i in range(3)]的值为__2__。
举一反三
- Python列表解析表达式[ i for i in range(5) if i%2!=0]的值分别为
- 已知 vec = [[1,2], [3,4]],则表达式 [[row[i] for row in vec] for i in range(len(vec[0]))]的值为______________()_________。[/i] A: [1, 2, 3, 4] B: [[1, 2, 3], 4] C: [[1, 3], [2, 4]] D: [1, 2, [3, 4]]
- 表达式 [str(i) for i in range(3)] 的值为 ( ) A: [1,2,3] B: [0,1,2] C: ['0', '1', '2'] D: 异常报警
- 已知 vec=[[1,2],[3,4]],则表达式[[row[i] for row in vec] for i in range(len(vec[0]))]的值为( )[/i]
- 已知x=[[1,2,3],[4,5,6]],表达式[[row[i] for row in x] for i in range(len(x[0]))]的值为(______ )。[/i]