Implement aPerson class with the following attributes:
The constructor will receive the name and birthday date. The gender and the place of birth should be initialized as empty strings.
Make the attributes private and create getter and setter methods. Write a __str__ method that prints the name and the age of the person (check the testcase for the format).
To calculate the age just subtract the year of birth to the current year (don't worry about the day/month, it is not an objective of this exercise). A datetime object has ayear attribute that is public.
To get the current date, use:
datetime.date.today()
which also has ayear attribute.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here