Given def check(x): return x > 5; print(list(filter(check, [3, 4, 5, 6, 7]))), what is the output?

  • [3, 4, 5, 6, 7]
  • [3, 4, 5]
  • [6, 7]
  • [6]
The filter function applies the check function to each element in the list [3, 4, 5, 6, 7] and returns only those for which check returns True. In this case, elements greater than 5 are [6, 7], so the output is [6, 7].
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *