Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a function called happybirthday that takes as input three dictionaries, name_to_day, name_to_month, and name_to_year, and combines them into a single dictionary month_to_all that contains

Create a function called happybirthday that takes as input three dictionaries, name_to_day, name_to_month, and name_to_year, and combines them into a single dictionary month_to_all that contains the month as the key and the name, (day, year, age) as the value of the month_to_all dictionary. For this problem, you may assume that the current year is 2022 - i.e. age = 2022 - year. Specifically, your function should:

  1. Have input arguments happybirthday(name_to_day, name_to_month, name_to_year), expecting name_to_day as a dictionary mapping a name (string) to a day in the month (integer), name_to_month as a dictionary mapping a name (string) to a month (integer)and name_to_year as a dictionary mapping a name to a year(integer). You may assume all inputs to be valid.
  2. Create a new dictionary month_to_all where the keys are all the months contained in name_to_month (note: if a month does not appear in 'name_to_month', it should not be included in 'month_to_all'), and contains information in the following structure name, (day, year, age), with (day, year, age) being the tuple of values from name_to_day, and name_to_year corresponding to name. Note: the value we want in this new dictionary is a tuple, where the first element of the tuple is the name from 'name_to_month' and the second element of the tuple is a tuple of day, year, age.
  3. Return month_to_all.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago