Back to Lesson

Matrix Flattening

Grasp the nested loops of comprehensions.

Instructions

  • Given
    matrix = [[1, 2], [3, 4], [5, 6]]
    .
  • Reduce the nested list into a flat list using a list comprehension representing two loops.
  • The outer loop runs across the rows. The inner loops runs across each item within the row.
  • Print the flattened list.
main.py
main.py