Pyhton (Matrix Calcu)
Pyhton (Matrix Calcu)
PROGRAMMING (CSE23202),2023
Note:-
if i==1:
print("which matrix you want to re-enter")
print("1.MATRIX-1")
print("2.MATRIX-2")
print("3.BOTH")
z=int(input("enter the serial no. of your choice from above given option:-"))
if z==1:
matrix1(a,b)
elif z==2:
matrix2(a,b)
else:
matrix1(a,b)
matrix2(a,b)
import numpy as o
a=o.array(m1)
b=o.array(m2)
print("choose an operation:-")
print("1.ADDITION")
print("2.SUBSTRACTION")
print("3.MULTIPLICATION")
choose=int(input("enter the serial no. of your choice from above given option:-"))
if choose==1:
print(a+b)
elif choose==2:
print(a-b)
elif choose==3:
print(a.dot(b))
else:
print("invalid choice")
Output
WELCOME TO THE MATRIX CALCULATOR
enter no. of rows of both the matrices:-2
enter no. of coloumns of both the matrices:-2
enter values of matrix-1
enter number:-3
enter number:-4
enter number:-4
enter number:-5
your matrix is:-
[3, 4]
[4, 5]
enter values of matrix-2
enter number:-1
enter number:-8
enter number:-9
enter number:-6
your matrix is:-
[1, 8]
[9, 6]
DO YOU WANT TO RE-ENTER ANY MATRIX
1.yes
2.No
enter the serial no. of your choice from above given option:-2
choose an operation:-
1.ADDITION
2.SUBSTRACTION
3.MULTIPLICATION
enter the serial no. of your choice from above given option:-3
[[39 48]
[49 62]]