0% found this document useful (0 votes)
20 views1 page

Leap Year

This Python code checks if a year entered by the user is a leap year by testing if the year is divisible by 4, 100, and 400.

Uploaded by

Stephen Fulop
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Leap Year

This Python code checks if a year entered by the user is a leap year by testing if the year is divisible by 4, 100, and 400.

Uploaded by

Stephen Fulop
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

leap year

is_leap_year = False

input_year = int(input())

if (input_year % 4) == 0:

if (input_year % 100) == 0:

if (input_year % 400) == 0:

print("{0} - leap year".format(input_year))

else:

print("{0} - not a leap year".format(input_year))

else:

print("{0} - leap year".format(input_year))

else:

print("{0} - not a leap year".format(input_year))

You might also like