They are telling me that it's wrong please guys correct me , the answer should be" Not a leap year" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

They are telling me that it's wrong please guys correct me , the answer should be" Not a leap year"

year = int(input()) if year/4: print ("Not a leap year") else: if year/100: print ("is a leap year") else: if year/400: print ("is a leap year") else: print("Not a leap year")

28th Feb 2021, 5:43 PM
Ngabirano Johnbosco
Ngabirano Johnbosco - avatar
3 Answers
0
I didn’t check your code but here is a correct one for a leap year https://code.sololearn.com/c88738ApCgGI/?ref=app
28th Feb 2021, 6:01 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
0
Hi! why do you divide the value of a year by four? what is the sign of a leap year and how do I find out?
28th Feb 2021, 6:03 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
To determine divisibility, check if number a can be divided by number b without a remainder. Remainder can be calculated by modulo operator % In code: if a % b == 0
28th Feb 2021, 6:05 PM
Benjamin Jürgens
Benjamin Jürgens - avatar