Given def process(item): return item * item; items = [1, 2, 3, 4]; result = map(process, items); print(list(result)), what will be the output?

  • [1, 2, 3, 4]
  • [1, 4, 9, 16]
  • [1, 8, 27, 64]
  • [2, 4, 6, 8]
The map function applies the process function to each element in items, squaring each element. The output is [1, 4, 9, 16].
Add your answer
Loading...

Leave a comment

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