A Python program that checks if the input value is a leap year and is a century
Fantastic news! We've Found the answer you've been seeking!
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 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.
Related Book For
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young
Posted Date: