[5 pts] Write a mapping feature for a calendar app:
a) [1 pts] Create a dictionary that records the number of days in each month (January to December).
b) [2 pts] Write a function that takes a dictionary as the argument.
1) The function requests the user to enter “year/month/day” (e.g., 2020/2/11) as an input
2) Given the month in 1), determine and return the corresponding number of days
Hint: Use method .split() to get the middle number for month.
c) [2 pts]
1) Given the year in 1), determine if the year is a leap year (any year divisible by 4)
a.If it’s a leap year, return 29 for month February
b.Otherwise, return 28.
3) Call the function using the dictionary you created in a).
[10 pts] Write a revenue management program for a best-buy store:
a) [2 pts] Use a dictionary to store the listed price of 3 products. Initialize another empty dictionary.
b) [2 pts] Request the user to input a product name.
1) If the product exists in the dictionary, print the price.
2) If the product doesn’t exist, request the user to enter the price. Insert the new product and the
price into the dictionary.
Hint: Reivew in-class exercises to see how you can check whether a key exists or not.
c) [1 pts] Request the user to enter the quality sold for each of the existing products, using “, ” as the separator. Note the space. The prompt should inform the user how many products exist in the dictionary so the user can input the correct amount of numbers. See the screenshot below.
For example, the user can enter “10, 100, 1, 0” if there are 4 products.
d) [2 pts] In a first for loop (must use for):
1) Calculate the sales revenue for each product.
2) Store the calculated numbers by inserting each product-revenue entry into the empty
dictionary you created in a).
e) [2 pts] In a second for loop, print the sales revenue across all items, using the format below. Also
print the total sales revenue. Must print numbers in correct format for full credit.
Bonus Question 1 [+1.5 X.C.]
Refer to the sample code for in-class exercise #2b. Do your own research on method .get() for dictionaries. Improve the sample code, by replacing the if statement by using .get() when updating the character frequency.