Menu
Coddy logo textTech

Recap - House Of Lists

Part of the Logic & Flow section of Coddy's Python journey — lesson 54 of 78.

challenge icon

Challenge

Easy

Create a function named house_of_lists that takes a list of lists list_of_lists as an argument. Each inner list contains numbers. The function should use list comprehensions to perform the following operations:

  1. Filter out inner lists that have a sum greater than 50, keeping only those whose sum is 50 or less.
  2. From the remaining inner lists, extract numbers that are less than 5.
  3. Combine all extracted numbers into a single list.
  4. Return the combined list of numbers.

Try it yourself

def house_of_lists(list_of_lists):
    # Write code here

All lessons in Logic & Flow