Write a mapping feature for a calendar app:

  1. [5 pts] Write a mapping feature for a calendar app:
  2. a) [1 pts] Create a dictionary that records the number of days in each month (January to December).

 

  1. b)  [2 pts] Write a function that takes a dictionary as the argument.
    1. 1)  The function requests the user to enter “year/month/day” (e.g., 2020/2/11) as an input
    2. 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.

  1. 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).

  1. [10 pts] Write a revenue management program for a best-buy store:
  2. a) [2 pts] Use a dictionary to store the listed price of 3 products. Initialize another empty dictionary.

 

 

  1. b)  [2 pts] Request the user to input a product name.
    1. 1)  If the product exists in the dictionary, print the price.
    2. 2)  If the product doesn’t exist, request the user to enter the price. Insert the new product and the

price into the dictionary.

  1. Hint: Reivew in-class exercises to see how you can check whether a key exists or not.
  2. 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.

  1. d)  [2 pts] In a first for loop (must use for):
    1. 1)  Calculate the sales revenue for each product.
    2. 2)  Store the calculated numbers by inserting each product-revenue entry into the empty

dictionary you created in a).

  1. 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.

 

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!