Question
All has to be done with Python Create a class Date. This exercise must be performed without using the datetime module at all. Data Attributes:
All has to be done with Python
Create a class "Date".
This exercise must be performed without using the datetime module at all.
Data Attributes:
1. day: int, private, getter property, setter property
2. month: int, private, getter property, setter property
3. year: int, private, getter property, setter property
Derived Properties:
1.is_leap_year: bool. Returns T/F based on if the year is a leap year or not.
2.is_valid_date: bool. Returns T/F based on if its a valid date or not.
Methods:
1. init takes 3 arguments: year, month, day. raise TypeErrors if they are not ints. raise ValueErrors if values are outside the expected bounds.
2. str Returns date in dd/mm/yyyy format
hint for str method:
d = 5
print(d.zfill(2))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started