Question: Task 2 : Current Age For this task, you will write a function current age that prompts the user to enter their birthday in the
Task : Current Age
For this task, you will write a function current age that prompts the user to enter their birthday in the format mmddyyyy and computes and returns their age as of the start date for this project, Write your definition for this function in a file called age py
Here are some examples of executing this function:
Here are some things to think about as you work on implementing this function.
The function takes no arguments, and returns the users age. It does not print the users age. If you are confused about the difference between print and return, ask an instructor.
The function will prompt the user to enter their birthday, and store this information as a string. You can assume that the user gives their birthday in the correct format. In order to find their age, you need to separate this out into three integers: the month, day, and year of their birthday. To do this, you will want to use the string method split. This will give you a list of strings, from which youll need to get three ints.
Think carefully about how to organize your comparisons to avoid writing code that is excessively complicated. It is strongly suggest that you work this out by hand, before writing any code.
If the users birthday is on for any year print a Happy Birthday! message, in additional to returning the users age.
Remember to include a docstring and type annotations, and include some helpful comments.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
