+ 1

Can u find the bug ? Plz run the code in else statement leap year program plz.

year = int(input()) if year%4!=0: print("Not a leap year") elif year%100!=0: print("Not a Leap year") elif year%400==0: print("Leap year") else: print("Not a leap year")

17th Feb 2021, 1:43 PM
Gayathri Uppada
5 Réponses
+ 3
Mohammad Saad not every year that gets divided by 4 is a leap year.
17th Feb 2021, 1:56 PM
Abhay
Abhay - avatar
+ 3
Mohammad Saad year 1700,1800 and 1900 aren't leap year but 4 divides each of them
17th Feb 2021, 2:11 PM
Abhay
Abhay - avatar
+ 1
Edited year=int(input()) if(year%4==0 and year%100!=0 or year%400==0): print(leap year") else: print("Not a leap year ") https://code.sololearn.com/cLCzB08UTSQq/?ref=app
17th Feb 2021, 1:54 PM
Mohammad Saad
Mohammad Saad - avatar
+ 1
Abhay Bro can you explain how ?pls give some example
17th Feb 2021, 2:01 PM
Mohammad Saad
Mohammad Saad - avatar
+ 1
I dont know about it thanks bro year=int(input()) if(year%4==0 and year%100!=0 or year%400==0): print("leap year ") else: print("not a leap year ") #Use this code
17th Feb 2021, 2:27 PM
Mohammad Saad
Mohammad Saad - avatar