Question: Complete the transform_2d_list() function that takes a single two-dimensional list as a parameter called a_2d_list. The parameter list has m items, where each item is
Complete the transform_2d_list() function that takes a single two-dimensional list as a parameter called a_2d_list. The parameter list has m items, where each item is a list with n items. The function returns a new two-dimensional list, where the first item is a list containing all of the first items in the list items of the original list, and the second item is a list containing all of the second items in the list items of the original list and so on. In other words, the two-dimensional list that is returned will have n items, where each item is a list with m items. You can assume that both m and n are at least 1. Some examples of the function being called are shown below.
For example:
| Test | Result |
|---|---|
a_2d_list = [[1]] print(transform_2d_list(a_2d_list)) | [[1]] |
a_2d_list = [['a'], ['b']] print(transform_2d_list(a_2d_list)) | [['a', 'b']] |
a_2d_list = [[1, 2], [3, 4]] print(transform_2d_list(a_2d_list)) | [[1, 3], [2, 4]] |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
