+ 1
23.2 Leap year challenge issue
Hi, I checked all comments first, but not sure why this won't work for all cases. Any explanation would be greatly appreciated. Thanks. year = int(input()) #your code goes here if year%4 != 0: print ("Not a leap year") elif year%100 != 0: print("Not a leap year") elif year%100 != 0: print("Not a leap year") elif year%400 != 0: print("Not a leap year") else: print("Leap year")
4 Réponses
+ 4
https://code.sololearn.com/cCupNWmi3x6Q/?ref=app
See I made some changes in ur code.
May be this will help you.
+ 2
You're welcome 🤗
+ 1
✨Kårï§hmå✨ thanks!
0
It says the year is NOT a leap year if it is evenly divisible by 100. So it should be:
elif year % 100 == 0
print("Not a leap year")
(And there are two code blocks written to check if the year is evenly divisible by 100 or not in your code. You only need one, right?)