In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 23rd
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #06 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

[IP055] Messy Matrix

Patty Bouvier, Marge’s gruff, chain-smoking sister, is usually too busy working at the DMV or binge-watching her favorite soap operas to dabble in anything tech-related. But one day, her boss hands her a data project: sorting a complicated DMV seating chart that’s been printed as a grid. The chart is a messy matrix of DMV employee numbers, arranged in rows and columns that doesn’t make much sense to anyone except her boss. Patty is unimpressed. She thinks: "Why can't this just be one simple list so I can get on with my day?"

The Problem

Write a function matrix_to_list(m) that given a matrix m given as a list of lists with r rows and c columns, returns a new list with all the elements of the matrix, first with the elements from the first row, then the second row, and so on.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

1 ≤ r, c ≤ 100       Number of rows and columns

Example Function Calls Example Output
print(matrix_to_list([ [1,2,3], [4,5,6], [7,8,9] ]))
print(matrix_to_list([ [9,8,7,6,5], [4,3,2,1,0] ]))
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto