The map() Function for Transforming Collections in Python


Apply a function to every item in a collection.

Source Code

squared_numbers = list(map(lambda x: x**2, numbers))
print(squared_numbers)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments