Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions