I have a if/else statement like this:
import numpy as np
rows_b = int(input("Enter the number of rows of matrix B : " ))
column_b = int(input("Enter the number of columns of matrix B : "))
print("Input elements of matrix B1:")
B1= [[float(input()) for i in range(column_b)] for j in range(rows_b)]
print("Input elements of matrix B2:")
B2= [[float(input()) for i in range(column_b)] for j in range(rows_b)]
b1 = np.array(B1)
b2 = np.array(B2)
result = np.all(b1 == b2[0])
if result:
print('matrix B1 = B2')
#if matrix B1 = B2, go to the next algorithm
else:
print('matrix B1 and B2 are not equivalent')
#if B1 and B2 are not equivalent, stop here.
B = np.array(B1)
print("Matrix B is: ")
for x in B:
print(x)
I want if B1 = B2 then continue to the next step (B = np.array (B1)) but (else) if B1 and B2 are not equal then stop algorithm (not continue to B = np.array (B1)), how ?