+ 7
[Challenge] Leap-year check
Write a program that gets an input year and tells the user if this year is a leap-year. Wikipedia quote: "In the Gregorian calendar, each leap year has 366 days instead of the usual 365, by extending February to 29 days rather than the common 28. These extra days occur in years which are multiples of four (with the exception of years divisible by 100 but not by 400)."
14 Antworten
+ 23
https://code.sololearn.com/c7VMXRWuJ4l7/?ref=app
+ 10
https://code.sololearn.com/cAI0n3syD74I/?ref=app
+ 8
https://code.sololearn.com/cl5PGtX5eomZ/?ref=app
+ 4
https://code.sololearn.com/c2Zf0s4xb5Yd/?ref=app
there it is....😎
+ 2
print("non-leap year"[(y%4==0 and (y%100!=0 or y%400==0))*4:])
+ 2
https://code.sololearn.com/cG3SZJ967wz9/?ref=app
+ 1
Hello, everyone! Here is my oneliner in python.
Please leave your comment and upvote!
https://code.sololearn.com/coFa3vGOZ579/
+ 1
The leap year check is part of this code which returns your age in days.
https://code.sololearn.com/cBL0khFXj96K/?ref=app
0
y = int(input())
if y % 4 == 0:
if y % 100 == 0 and y % 400 != 0:
print("False")
else:
print("True")
else:
print("False")