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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!