3. Write a Python Numpy program to generate the addition, subtraction, multiplication and division of two values.
The output is:
Value = 2 and 5
Expected Answer:
Addition of 2 and 5 is 7
Subtraction of 2 and 5 is -3
Multiplication of 2 and 5 is 10
Division of 2 and 5 is 0.4
Sample Answer:
import numpy as np print("Addition of 2 and 5 is", np.add(2, 5)) print("\nSubtraction of 2 and 5 is", np.subtract(2, 5)) print("\nMultiplication of 2 and 5 is", np.multiply(2, 5)) print("\nDivision of 2 and 5 is", np.divide(2, 5))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)