单选题
适中
#15553
在Python中,下面代码的输出结果?( ) import numpy as np arr = np . array ( [ 1 , 2 , 3 , 4 , 5…
在Python中,下面代码的输出结果?( )
答案与解析
正确答案:B
解析
arr[::2]切片操作选取第0、2、4个元素(1,3,5),求和结果为9。NumPy数组支持步长切片,与Python列表类似。