Se7enSquared
10/18/2019 - 5:53 PM

Map a function across a list

MAP function - apply a function to every element in a list

# Python code to apply a function on a list 
income = [10, 30, 75] 
  
def double_money(dollars): 
    return dollars * 2
  
new_income = list(map(double_money, income)) 
print(new_income) 

# output: [20, 60, 150]