+ 1

How to solve error by reading the output

n1=np.array([10,20]) n2=np.array([30,40]) np.sum([n1,n2]) // File "<ipython-input-75-5a200b0c694f>", line 5 np.sum([n1,n2],axis=0) ^ IndentationError: unexpected indent // np.sum([n1,n2],axis=0) //TypeError Traceback (most recent call last) <ipython-input-76-0393fb435e2a> in <module> ----> 1 np.sum([n1,n2],axis=0) TypeError: _sum() got multiple values for argument 'axis'// np.sum([n1,n2],axis=1) //TypeError Traceback (most recent call last) <ipython-input-78-ab28a16e3e16> in <module> ----> 1 np.sum([n1,n2],axis=1) TypeError: _sum() got multiple values for argument 'axis'//

25th Nov 2021, 5:42 PM
mariam elburai
2 Respostas
+ 4
mariam elburai , not quite sure what you expect: ( just try it) the main issue is the incorrect indentation of the output, and the absence of the print() function import numpy as np n1=np.array([10,20]) n2=np.array([30,40]) print(np.sum([n1,n2]) ) print(np.sum([n1,n2], axis = 0) ) print(np.sum([n1,n2], axis = 1) ) since you just have joined sololearn, and not started a python tutorial, it is recommended to learn and work from one of these tutorials.
25th Nov 2021, 6:34 PM
Lothar
Lothar - avatar
+ 2
Focus on these parts: line 5     np.sum([n1,n2],axis=0)     ^ IndentationError: unexpected indent // =============================== 1 np.sum([n1,n2],axis=1) TypeError: _sum() got multiple values for argument 'axis'//
25th Nov 2021, 6:33 PM
Simon Sauter
Simon Sauter - avatar