Given the following expressions:
matrix = [[1,2,3],[4,5,6],[7,8,9]]
A matrix is created, then a list comprehension is executed to create a flat list. The comprehension runs from left to right.
flat = [x for row in matrix for x in row]
Subsequently for each row in the matrix its values are squared. How is this comprehension evaluated?
squared = [[x**2 for x in row] for row in matrix]