0

Where in my code problem exists?

year = int(input()) #your code goes here if year%4==0: if year%100==0: if year%400==0: print("Leap year") else: print("Not a leap year") else: print("Not a leap year") else: print("Not a leap year")

7th Feb 2021, 11:23 AM
Md Imraj Hossain
Md Imraj Hossain - avatar
1 Answer
+ 6
_Imraj Not every year that gets divided by 4 needs to get divided by 100 and 400 as well for it to be a leap year , according to your program the only leap years would be 400,800,1200,1600,2000 which obviously is wrong . Leap year are those that if divided by 100 , gets divided by 400 , also those are counted as leap year that gets divided by 4 (but not every year that gets divided by 4 is counted as leap year)
7th Feb 2021, 11:34 AM
Abhay
Abhay - avatar