Find Largest Numbers in Each Nested List #
Write a function that takes a nested list as input and returns a list containing the largest number from each sublist. If there is no value in a sublist, returns None.
For example:
Input: [[1, 2, 3], [4, 5, 6], [7, 8, 9], []]
Output: [3, 6, 9, None]
Tests #
find_largest_numbers([[1, 2, 3], [4, 5, 6], [7, 8, 9], []])should return[3, 6, 9, None]find_largest_numbers([[15, 25, 35], [45, 55, 65], [], [75, 85, 95], [105, 115, 125]])should return[35, 65, None, 95, 125]find_largest_numbers([[100, 200, 300], [400, 500, 600], [700, 800, 900], [1000, 1100, 1200]])should return[300, 600, 900, 1200]find_largest_numbers([[-1, -2, -3], [-4, -5, -6], [-7, -8, -9], [-10, -11, -12]])should return[-1, -4, -7, -10]find_largest_numbers([[], [], [], []])should return[None, None, None, None]
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules