Mid2 33rd_to_Define_a_Matrix
r = int(input("Enter the number of rows:"))
c = int(input("Enter the number of columns:"))
matrix = []
print("Enter the entries rowwise: ")
for i in range(r):
a=[]
for j in range(c):
a.append(int(input( )))
matrix.append(a)
for i in range(r):
for j in range(c):
print(matrix[i][j], end = " ")
print()
#output:
Enter the number of rows:2
Enter the number of columns:2
Enter the entries rowwise:
1
2
3
4
1 2
3 4
Comments
Post a Comment