Question
A leap year is a year that has 366 days instead of the normal 365. Leap years occur every 4 years, except every 100th year
A leap year is a year that has 366 days instead of the normal 365. Leap years occur every 4 years, except every 100th year is not a leap year. However, every 400th year is a leap year. Write a program that asks the user for a year, and outputs whether it is a leap year or not.
Some Outputs (user input highlighted)
Enter year: 1896
Yes, 1896 is a leap year
Enter year: 1996
Yes, 1996 is a leap year
Enter year: 1900
No, 1900 is not a leap year
Enter year: 2000
Yes, 2000 is a leap year
Enter year: 2018
No, 2018 is not a leap year
Enter year: 2020
Yes, 2020 is a leap year
Hint: you have to find out what numbers (4, 100, 400) are divisors of the input year (which arithmetic operator does that?) and use if/elif/else statements to determine if it is a leap year or not.
use python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started