“reduceat” Kode Jawaban

reduceat

array = np.arange(10)
indices = np.array([1,3,4,5])
output = numpy.add.reduceat(array,indices)  
print(output)
Homeless Heron

reduceat

print("Step1 : ", np.add.reduce(array[1:3]))
print("Step2 : ", np.add.reduce(array[3:4]))
print("Step3 : ", np.add.reduce(array[4:5]))
print("Step4 : ", np.add.reduce(array[5:]))
Homeless Heron

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya