Skip to content

Instantly share code, notes, and snippets.

@MahraibFatima
Created March 19, 2024 16:12
Show Gist options
  • Save MahraibFatima/b937c8daf5d6021ab466310ff0526e6c to your computer and use it in GitHub Desktop.
Save MahraibFatima/b937c8daf5d6021ab466310ff0526e6c to your computer and use it in GitHub Desktop.
Determine whether the entered year is a leap year or not .
def is_leap_year(year):
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
return True
return False
year = int(input("Enter a year: "))
if is_leap_year(year):
print("Leap year")
else:
print("Not a leap year")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment