Create a 3*4 matrix using Python for loop.
Output should be in the following form
01 02 03 04
21 22 23 24
31 32 33 34
Create a 3*4 matrix using Python for loop.
Output should be in the following form
01 02 03 04
21 22 23 24
31 32 33 34
for i in range(1,4):
for j in range(1,5):
print(f"{i}{j}",end=" ")
print()
matrix = []
for i in range(3):
row = []
for j in range(4):
row.append(i * 4 + j + 1)
matrix.append(row)
for row in matrix:
print(" β.join(fβ{num:02d}" for num in row))
for i in range(4):
for j in range(1,5):
print(f"{i}{j}",end=" ")
print()
for i in range(0,4):
if i==1:
continue
for j in range(1,5):
print(f"{i}{j}",end=" ")
print()
#python program to print matrix using loop
row=int(input("enter number of rows"))
col=int(input("enter number of columns"))
for i in range(0,row):
for j in range(1,col):
print(f"{i}{j}",end=" ")
output:-
enter number of rows3
enter number of columns4
01 02 03
11 12 13
21 22 23
#python program to print matrix using loop
row=int(input("enter number of rows: β))
col=int(input(βenter number of columns: β))
for i in range(0,row):
for j in range(1,col):
print(fβ{i}{j}β,end=β ")
print()
great work .keep going
good. keep practicing.
good work, keep going
very good. keep active
verygood, keep practicing