Hey guys need help understanding the Leap year exercise | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hey guys need help understanding the Leap year exercise

year = int(input()) if year % 4 != 0: print("Not a leap year") elif year % 100 != 0: print("leap year") elif year % 400 != 0: print("Not a leap year") else: print("Not a leap year") Where am i wrong?

15th Apr 2021, 8:12 PM
Aaryn Robinson
Aaryn Robinson - avatar
4 Answers
0
https://www.sololearn.com/Discuss/2710373/?ref=app
16th Apr 2021, 1:10 AM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
0
There are times when using a function makes things much neater: https://code.sololearn.com/ca25a6a3a8A4
16th Apr 2021, 4:07 AM
Myk Dowling
Myk Dowling - avatar
0
What about replacing the second block with this: elif year % 100 == 0: print("Not a leap year") and replacing else block with this: else: print("Leap year")
18th Oct 2021, 12:11 PM
Moe Thae Nwe
Moe Thae Nwe - avatar