+ 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)."

8th Feb 2018, 4:16 PM
Alex
Alex - avatar
14 Antworten
8th Feb 2018, 4:36 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 23
https://code.sololearn.com/c7VMXRWuJ4l7/?ref=app
4th Mar 2018, 5:53 PM
MeanMachine
MeanMachine - avatar
8th Feb 2018, 4:48 PM
LukArToDo
LukArToDo - avatar
+ 10
https://code.sololearn.com/cAI0n3syD74I/?ref=app
8th Feb 2018, 4:30 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 8
https://code.sololearn.com/cl5PGtX5eomZ/?ref=app
27th May 2018, 3:27 PM
Prabhat
Prabhat - avatar
28th Feb 2018, 7:12 AM
STRIKER
+ 2
print("non-leap year"[(y%4==0 and (y%100!=0 or y%400==0))*4:])
8th Feb 2018, 4:47 PM
VcC
VcC - avatar
+ 2
https://code.sololearn.com/cG3SZJ967wz9/?ref=app
11th Feb 2018, 10:35 AM
D Janapriya
D Janapriya - avatar
+ 1
Hello, everyone! Here is my oneliner in python. Please leave your comment and upvote! https://code.sololearn.com/coFa3vGOZ579/
8th Feb 2018, 8:52 PM
Pedro Maimere
Pedro Maimere - avatar
+ 1
The leap year check is part of this code which returns your age in days. https://code.sololearn.com/cBL0khFXj96K/?ref=app
9th Feb 2018, 10:38 PM
davy hermans
davy hermans - avatar
0
y = int(input()) if y % 4 == 0: if y % 100 == 0 and y % 400 != 0: print("False") else: print("True") else: print("False")
4th Mar 2018, 7:25 PM
Ishan Rathi
Ishan Rathi - avatar