J Julipkq New member Sep 20, 2021 #1 What will be the output of the following Python code? Code: l=[[1 ,2, 3], [4, 5, 6], [7, 8, 9]] [[row[i] for row in l] for i in range(3)] A. Error B. [[1, 4, 7], [2, 5, 8], [3, 6, 9]] C. 1 4 7 2 5 8 3 6 9 D. (1 4 7) (2 5 8) (3 6 9)
What will be the output of the following Python code? Code: l=[[1 ,2, 3], [4, 5, 6], [7, 8, 9]] [[row[i] for row in l] for i in range(3)] A. Error B. [[1, 4, 7], [2, 5, 8], [3, 6, 9]] C. 1 4 7 2 5 8 3 6 9 D. (1 4 7) (2 5 8) (3 6 9)
N Ngô Thị Vân New member Sep 20, 2021 #2 Answer: b Explanation: In the code shown above, ‘3’ is the index of the list. Had we used a number greater than 3, it would result in an error. The output of this code is: [[1, 4, 7], [2, 5, 8], [3, 6, 9]]. Upvote 0 Downvote
Answer: b Explanation: In the code shown above, ‘3’ is the index of the list. Had we used a number greater than 3, it would result in an error. The output of this code is: [[1, 4, 7], [2, 5, 8], [3, 6, 9]].