import numpy as np
x = np.array([[1,2],[3,4]])
y = np.array([[5,6],[7,8]])
print("Addition: ")
print(np.add(x,y))
print("Subtraction: ")
print(np.subtract(x,y))
print("Multiplication: ")
print(np.multiply(x,y))
print("Divison: ")
print(np.divide(x,y))
Output
Enter first number:-4
4.0 <class 'float'>
Enter second number:-64
(64 0j) <class 'complex'>
Enter third number:-45
(45 0j) <class 'complex'>
I have deleted the numpy and reinstall it,then also its not working
Error image
Code file image
Correct output
CodePudding user response:
The output doesn't seem to match the code you posted, however, since the error is:
AttributeError: module 'numbers' has no attribute 'Integral'
the problem could be that you have a file called numbers.py inside the same folder of exp13Q10_1.py or in the same search path as explained in this answer.
EDIT:
As explained in "The Module Search Path" paragraph of Python documentation, when you import a module (let's call it my_module) the interpreter searches for a built-in module with that name, if it doesn't find it, it searches for my_module.py
in a list of directories given by the variable sys.path
.
sys.path
is initialized from these locations:
- The directory containing the input script (or the current directory when no file is specified).
PYTHONPATH
(a list of directory names, with the same syntax as the shell variable PATH).- The installation-dependent default (by convention including a site-packages directory, handled by the site module).
Take a look at the linked paragraph for more information of sys.path
and PYTHONPATH
.