Please answer it in Python In order not to forget to wish the birthday of his loved ones, Alzheimer wants to memorize and manage their dates of birth via a computer program in Python. At first, it is assumed that Al has already computerized the birthday dates of his relatives in a dictionary. The keys in this dictionary are the first names of his relatives (it is assumed that no two people with the same first name). The value associated with each key corresponds to the birthday of the corresponding person, in the form of a 3-item list, containing in the order the day, month and year of birth. The day is considered to be an integer between 1 and 31, the month an integer between 1 and 12 and the year of birth an integer between 1900 and 2021. Thus the list [17, 5, 2021] corresponds to the date of May 17, 2021. This may lead to writing dates that do not exist (e.g. [31, 4, 2003]) but this is not addressed in the exercise. Here is an example of a dictionary containing the dates of birth of 5 friends of Al in this format: dictionary_friends={'Chiara': [11, 10, 1998], 'Omar': [22, 11, 2001], 'Ingrid': [12, 6, 2002], 'Marc': [27, 8, 1983], 'Youri': [12, 6, 1983]}. We wish to be able to wish the birthday of all loved ones born on a given day. Write a function feter_anniversaire that takes as arguments the dictionary of dates of birth ddates and the list date_jour corresponding to today's date. The function then displays a message for each loved one whose the birthday on that date, specifying its age, according to the format of the example below. Thus, if the dictionary_friends is the example given at the beginning of the exercise: the call feter_anniversaire(dictionary_friends, [12, 6, 2021]) will display: Happy birthday Ingrid you are 19 years old! Happy birthday Youri you are 38 years old! call feter_anniversaire(dictionary_friends, [17, 5, 2020]) will display: No birthday today.
Please answer it in Python
In order not to forget to wish the birthday of his loved ones, Alzheimer wants to memorize and manage their dates of birth via a computer program in Python. At first, it is assumed that Al has already computerized the birthday dates of his relatives in a dictionary. The keys in this dictionary are the first names of his relatives (it is assumed that no two people with the same first name). The value associated with each key corresponds to the birthday of the corresponding person, in the form of a 3-item list, containing in the order the day, month and year of birth. The day is considered to be an integer between 1 and 31, the month an integer between 1 and 12 and the year of birth an integer between 1900 and 2021. Thus the list [17, 5, 2021] corresponds to the date of May 17, 2021. This may lead to writing dates that do not exist (e.g. [31, 4, 2003]) but this is not addressed in the exercise. Here is an example of a dictionary containing the dates of birth of 5 friends of Al in this format:
dictionary_friends={'Chiara': [11, 10, 1998], 'Omar': [22, 11, 2001], 'Ingrid': [12, 6, 2002], 'Marc': [27, 8, 1983], 'Youri': [12, 6, 1983]}.
We wish to be able to wish the birthday of all loved ones born on a given day.
Write a function feter_anniversaire that takes as arguments the dictionary of dates of birth ddates and
the list date_jour corresponding to today's date. The function then displays a message for each loved one whose the birthday on that date, specifying its age, according to the format of the example below.
Thus, if the dictionary_friends is the example given at the beginning of the exercise:
- the call feter_anniversaire(dictionary_friends, [12, 6, 2021]) will display:
Happy birthday Ingrid you are 19 years old!
Happy birthday Youri you are 38 years old!
- call feter_anniversaire(dictionary_friends, [17, 5, 2020]) will display:
No birthday today.
Step by step
Solved in 2 steps with 1 images