第三方库numpy用于科学计算和数据分析,分析程序,指出b[1][2]和c[2][2]的数据是( )。import numpy as npa=np.array([[1,1,1],[2,2,2],[3,3,3]]) b=np.array([[1,2,3],[4,5,6],[7,8,9]]) print(a)print(b)c=a+bprint(c)
举一反三
- 已定义 import numpy as np a = np.array([1, 2, 3, 4]), 则 a[0:2:1]的值是什么?
- 存在多维数组arr,arr =np.array([[1 2 3] [4 5 6] [7 8 9]])数组arr.T的输出为 A: array([[1, 4, 7], [2, 5, 8], [3, 6, 9]]) B: array([[1, 2, 3], [4, 5, 8], [7, 6, 9]]) C: array([[1, 4, 7], [2, 5, 6], [3, 8, 9]]) D: array([[9, 4, 7], [2, 5, 8], [3, 6, 1]])
- ndarray对象实例a,代码如下:import numpy as npa = np.array([[0, 1, 2, 3, 4], [9, 8, 7, 6, 5]])a.shape的执行结果是什么?
- 以下程序的输出结果是: frame = [[1,2,3],[4,5,6],[7,8,9]] rgb = frame[::-1] print(rgb) A: [[7, 8, 9]] B: [[1,2,3],[4,5,6],[7,8,9]] C: [[7, 8, 9], [4, 5, 6], [1, 2, 3]] D: [[1, 2, 3], [4, 5, 6]]
- 以下程序的输出结果是:( )。frame = [[1,2,3],[4,5,6],[7,8,9]]rgb = frame[::-1]print(rgb) A: [[1,2,3],[4,5,6],[7,8,9]] B: [[1, 2, 3], [4, 5, 6]] C: [[7, 8, 9], [4, 5, 6], [1, 2, 3]] D: [[7, 8, 9]]