I'm stuck - Python for beginners 22.3 Leap Year | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm stuck - Python for beginners 22.3 Leap Year

Hello everyone! Nice to meet this community :) I'm scratching my head and wondering why I'm not getting the right output for my code. I have to code using if/else statements to accurately label dates as either a "leap year" or "not a leap year". So far I am only getting 3/7 right. Anybody able to point me in the right direction? Thanks! Code: year = int(input()) if year%4 == 0: if year%100 == 0: if year%400 == 0: print("Leap year") else: print("Not a leap year")

15th Sep 2021, 9:51 PM
Adam Sturrock
Adam Sturrock - avatar
1 Answer
+ 1
Hi Adam! We discussed about the same thing with someone a few weeks ago. I'm sharing this post with you to understand it clearly. https://www.sololearn.com/Discuss/2869945/?ref=app
16th Sep 2021, 1:40 AM
Python Learner
Python Learner - avatar