-
Notifications
You must be signed in to change notification settings - Fork 0
/
A_8_completed.py
42 lines (34 loc) · 951 Bytes
/
A_8_completed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def take_matrix(m, n):
out = []
for i in range(m):
row = []
for j in range(n):
element = int(input(f"Enter Element [{i}][{j}] :"))
row.append(element)
out.append(row)
return out
def saddle():
# take no. of rows and columns
m = int(input("Enter Rows Of Matrix : "))
n = int(input("Enter Columns Of Matrix : "))
# take matrices A and B
print("\n\tMATRIX A")
A = take_matrix(m, n)
for row in range(m):
min_row = A[row][0]
col_index = 0
for col in range(n):
if (min_row > A[row][col]):
min_row = A[row][col]
col_index = col
k = 0
for k in range(n):
if (min_row < A[k][col_index]):
break
k += 1
if k == n:
print("Value of Saddle Point ", min_row)
print(f"Index of {min_row} is [{row}][{col_index}]")
return True
# main
saddle()