Back to Lesson

Mapping Functions

Run numerical translations against existing dictionaries dynamically.

Instructions

  • Given
    prices = {"apple": 2.0, "banana": 1.5, "cherry": 3.0}
    .
  • Your market wants to apply a 10% discount to all products!
  • Build a dictionary comprehension where the new value is the old value multiplied by 0.90.
  • Print the formatted dictionary.
main.py
main.py