fork download
  1. matrix = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]
  2. # Accessing an element (row 2, column 3)
  3. element = matrix[1][2]
  4. print("Element at row 2, column 3:", element)
  5. # Output: 6
  6.  
  7. # Iterating through the nested list
  8. for row in matrix:
  9. for col in row:
  10. print(col, end=' ')
  11. print()
Success #stdin #stdout 0.03s 9572KB
stdin
Standard input is empty
stdout
Element at row 2, column 3: 6
1 2 3 
4 5 6 
7 8 9