Question: Define a class named Date that represents a date with a month and day. The class should have two integer attributes: month and day. The
Define a class named Date that represents a date with a month and day.
The class should have two integer attributes: month and day.
The constructor should perform the following validation:
Check if both arguments month and day are integers. If not, raise a ValueError.Check if the month value is between and If not, raise a ValueError.Check if the day value is between and If not, raise a ValueError.
Hint: Using the isInstance function can help verify the type of a variable.
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
