Answers for "map list in python"

1

map in python

items = [1, 2, 3, 4, 5]
squared = []
for i in items:
    squared.append(i**2)
Posted by: Guest on August-19-2021
-1

map in python

from functools import reduce
product = reduce((lambda x, y: x * y), [1, 2, 3, 4])

# Output: 24
Posted by: Guest on August-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language