Answers for "py map function"

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
0

map in python

items = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x**2, items))
Posted by: Guest on August-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language