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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started