Skip to content

Commit 15c9a6d

Browse files
committed
Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory
1 parent 9b945cb commit 15c9a6d

File tree

7 files changed

+8
-7
lines changed

7 files changed

+8
-7
lines changed
File renamed without changes.
File renamed without changes.

Diff for: matrix/matrix_multiplication_addition.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import print_function
2+
13
def add(matrix_a, matrix_b):
24
rows = len(matrix_a)
35
columns = len(matrix_a[0])
@@ -63,13 +65,12 @@ def main():
6365
matrix_b = [[3, 4], [7, 4]]
6466
matrix_c = [[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34], [41, 42, 43, 44]]
6567
matrix_d = [[3, 0, 2], [2, 0, -2], [0, 1, 1]]
66-
67-
print(add(matrix_a, matrix_b))
68-
print(multiply(matrix_a, matrix_b))
69-
print(identity(5))
70-
print(minor(matrix_c , 1 , 2))
71-
print(determinant(matrix_b))
72-
print(inverse(matrix_d))
68+
print('Add Operation, %s + %s = %s \n' %(matrix_a, matrix_b, (add(matrix_a, matrix_b))))
69+
print('Multiply Operation, %s * %s = %s \n' %(matrix_a, matrix_b, multiply(matrix_a, matrix_b)))
70+
print('Identity: %s \n' %identity(5))
71+
print('Minor of %s = %s \n' %(matrix_c, minor(matrix_c , 1 , 2)))
72+
print('Determinant of %s = %s \n' %(matrix_b, determinant(matrix_b)))
73+
print('Inverse of %s = %s\n'%(matrix_d, inverse(matrix_d)))
7374

7475
if __name__ == '__main__':
7576
main()

0 commit comments

Comments
 (0)