Question: Write a Python program that uses a main function and two additional functions named isValid and isLeap to do some basic calculations on a date.
Write a Python program that uses a main function and two additional functions named isValid and isLeap to do some basic calculations on a date. You are provided the main function below. You need to write the isValid and isLeap functions:
def main:
printEnter a negative month, day, or year to quit.
print
while True:
month intinputEnter the month:
day intinputEnter the day:
year intinputEnter the year:
if month or day or year :
break
if isValidmonth day, year True:
printThe date is valid.
if isLeapyear True:
printThe year is a leap year.
else:
printThe year is not a leap year.
else:
printThe date is invalid.
print
The isValid function accepts month, day, and year into the module as parameters. If the date is a valid date, the function will return True. Otherwise, the function will return False.
The isLeap function accepts the year into the module as a parameter. If the year is a leap year, the function returns True. Otherwise, the function will return False.
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
