Too Many Blanks

Data with PythonMedium+10 XP+10

Too Many Blanks

A sports club's sign-up forms come back as a list of dictionaries, one per form. A box left blank holds None. Every form has a name, and the name is never blank.

The secretary will phone anyone who left more than a certain number of boxes empty. Counting gaps per column won't help here. The question is about each form.

Task: write forms_to_chase(replies, max_blanks).

  • Count the blank boxes on each form.
  • Return the names of the forms with more than max_blanks blanks, in the original order. A form with exactly max_blanks blanks is fine.
  • If no form has too many, return [].

There is always at least one form.

Examples

replies = [{"name": "Ana", "age": 34, "phone": None, "team": None}, {"name": "Ben", "age": None, "phone": "0711", "team": "A"}, {"name": "Cara", "age": None, "phone": None, "team": None}]
max_blanks = 1
returns ['Ana', 'Cara']
replies = [{"name": "Dev", "age": 20, "phone": "0722"}, {"name": "Eli", "age": None, "phone": None}]
max_blanks = 2
returns []

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run