Map Abstraction
Map
Syntax
map(f, list)Example
items = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x**2, items))
#output [2, 4, 6, 8, 10]Last updated
Was this helpful?
Map
map(f, list)items = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x**2, items))
#output [2, 4, 6, 8, 10]Last updated
Was this helpful?
Was this helpful?