Answers for "find a leap year in python"

5

python leap year solution

def is_leap(year):
   return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
Posted by: Guest on March-21-2021
2

getting leap year in python

year = int(input("Write any year to check if it is leap year:- "))
if year % 4 == 0:
  if year % 100 == 0:
    if year % 400 == 0:
      print("Leap year.")
    else:
      print("Not leap year.")
  else:
    print("Leap year.")
else:
  print("Not leap year.")
Posted by: Guest on June-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language