Can anyone find the bug in this code the output is accurate but still showing some bugs,else in leap year program,code here | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone find the bug in this code the output is accurate but still showing some bugs,else in leap year program,code here

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

17th Feb 2021, 12:30 PM
Gayathri Uppada
3 Answers
0
Why do you have the extra two if statements? if year%100==0: if year%400==0: That will make it so you only get about 1 out of every 40 leap years. Also please always include the programming language in your tags.
17th Feb 2021, 3:37 PM
Elijah Brown
Elijah Brown - avatar
0
year = int(input()) if year % 400 == 0: print('leap year') elif year % 4 == 0 and year % 100 != 0: print('leap year') else: print('not leap year')
20th Mar 2021, 7:55 AM
Ishtiaque Ahmed
0
Pls someone help paste the leap year question here.
15th May 2021, 9:49 PM
Samuel Mbah
Samuel Mbah - avatar