← Back to challenges

Reverse Dictionary

PythonHarddata_structureslanguage_fundamentals

Instructions

You have a dictionary with years 2015-2020 as keys and some albums released for each year as key values. Write a function that takes an album and returns the year in which it was released.

Examples

release_year("Ode to Joy") ➞ 2019

release_year("Honeymoon") ➞ 2015

release_year("Fake_album") ➞ "Unknown"

Notes

  • Albums dictionary is made for you.
  • If the album isn't in the dictionary, return the string "Unknown".
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.