We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

here, the return statement returns in boolean. where the given conditions in the problem are put.a year is a leap year if it is divisible by 4 and 400 but not divisible by 100.

## Write a function

You are viewing a single comment's thread. Return to all comments →

Adding parenthesis increases readability. I might be wrong though!

what is the logic of this.....man!!!!

here, the return statement returns in boolean. where the given conditions in the problem are put.a year is a leap year if it is divisible by 4 and 400 but not divisible by 100.

You may find the

logichere.@karthik_bharadh1

Thanks for this , this page cleared everything about Leap years !

def is_leap(year): leap = False if year%4==0: leap=True elif year%100==0 and year%400==0: leap=True else: leap=False return leap

year = int(input()) print(is_leap(year))

why it is giving error on input 2100