Skip to content

Commit

Permalink
Iterating Over a 2D List (Matrix)
Browse files Browse the repository at this point in the history
  • Loading branch information
oneananda committed Oct 28, 2024
1 parent cdcfdd8 commit e33b534
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 0010-For-Loops/for_loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,22 @@
print(f"{COMMENT} - finish")
print("======================================================")

COMMENT = "Iterating Over a 2D List (Matrix)"

print(f"{COMMENT} - start")
print()

MATRIX = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]

for row in MATRIX:
for column in row:
print(column, end=" ")
print() # New line after each row

print()
print(f"{COMMENT} - finish")
print("======================================================")

0 comments on commit e33b534

Please sign in to comment.