Lambda functions with iterables
You've used lambda functions to perform actions on a single value; now it's time to test yourself on working with iterables.
You've been provided with a list called sales_prices
containing sales prices for several items. Your goal is to use a lambda function to add tax (20%) to each value in the list.
This exercise is part of the course
Intermediate Python for Developers
Exercise instructions
- Create
add_taxes
, which multiplies each value insales_prices
by 20%. - Print a list using
add_taxes
to update values insales_prices
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
sales_prices = [29.99, 9.95, 14.50, 39.75, 60.00]
# Create add_taxes to add 20% to each item in sales_prices
add_taxes = ____(____, ____)
# Use add_taxes to return a new list with updated values
print(____(____))