Question: A Python program that checks if the input value is a leap year and is a century year (ending in 00) how can I Define
- A Python program that checks if the input value is a leap year and is a century year (ending in 00) how can I Define a function called leap_check that takes a parameter called input_year and returns an int value
- 1 if its input_year ends in 00 and is a leap year
- 0 if input_year is not a leap year
- -1 if input_year is a leap year but does not end in 00
- Define a function called main
- Ask the user for a year to be input
- Validate that the input value is a positive 4-digit number
- If it is a 4 digit number
- call the leap_check function and pass in the input value
- Display with a descriptive sentence as one of the following based on the return value
- (Hint: you will need an if statement to determine which line gets displayed)
- is a leap year and a century year
- is a leap year but not a century-year
- is not a leap year
- if its not a 4 digit year
- Display a message "Invalid input"
- Your program should terminate after displaying the message if it reaches this branch
- Don't forget to call main() as the last line of your script.
Step by Step Solution
There are 3 Steps involved in it
def leapcheckinputyear Check if its a leap year if inputyear 4 0 and inputye... View full answer
Get step-by-step solutions from verified subject matter experts
