Created
October 21, 2022 04:17
-
-
Save RaMSFT/873d4496cbe9710d6d10f36518104e83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def leapyear(year): | |
if year % 100 == 0: | |
if year % 400 == 0: | |
return f"year: {year} is a leap year" | |
else: | |
return f"year: {year} is not a leap year" | |
else: | |
if year % 4 == 0: | |
return f"year: {year} is a leap year" | |
else: | |
return f"year: {year} is not a leap year" | |
print(leapyear(1900)) | |
print(leapyear(2001)) | |
print(leapyear(2400)) | |
print(leapyear(1996)) | |
print(leapyear(2002)) | |
print(leapyear(2300)) | |
print(leapyear(2024)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment