getting leap year in python 1

getting leap year in python

def is_leap(year):
   return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)

Here is what the above code is Doing:
1. It’s defining a function called is_leap.
2. It’s taking one parameter, year.
3. It’s returning the result of the expression year % 4 == 0 and (year % 100 != 0 or year % 400 == 0).

Similar Posts