以下代码的运行结果是( )。import numpy as np a=np.arange(8).reshape(2,4) s=a.sum(axis=0) print(s)
A: [6 22]
B: 28
C: 36
D: [4 6 8 10]
A: [6 22]
B: 28
C: 36
D: [4 6 8 10]
举一反三
- 如下代码的输出是( )import numpy as npa = np.arange(6).reshape(3, 2)b = a.sum(axis=0)c = b.sum(axis=0)
- 如下代码的输出结果是( )import numpy as npa = np.arange(12).reshape(3, 4)print(np.sum(a[[0, 2], 2:]))
- 如下代码的输出结果是( )import numpy as npa = np.arange(12).reshape(3, 4)print(np.sum(a[1:, 2:]))
- 下面程序段的执行结果为_______。 import numpy as np t = np.arange(120).reshape(3,4,5,2) t0=np.sum(t,axis=1) print(t0.shape)
- 以下代码的输出结果是()for i in range(0,10,2): print(i,end="") A: 0 2 4 6 8 B: 2 4 6 8 C: 0 2 4 6 8 10 D: 2 4 6 8 10