Hi, so... this video will explain how map works together with lambda and a list. It's a very nice and pythonic way to code, so let's go see this video!
# create a list
l1 = [2,4,7,8]
# add this code to obtain the square of each value in the list
print(list(map(lambda x: x**2,l1)))
That's all.
See ya
Comments
Post a Comment