Challenge: Map the Days
This lesson brings you a challenge to solve.
We'll cover the following
Problem statement
Make a map to hold together the number of days in a week (1 -> 7) with its name. Make sure to follow the following key-value pair pattern (KEY: VALUE):
1: Monday
2: Tuesday
3: Wednesday
4: Thursday
5: Friday
6: Saturday
7: Sunday
Then write a function that takes a key and returns the value associated with it. If a non-existent key is given, the function should return the message: Wrong Key.
Input
An integer
Sample input
4
Output
A string
Sample output
Thursday
Try to implement the function below. Feel free to view the solution, after giving some shots. Good Luck!
Get hands-on with 1400+ tech skills courses.