code for leap year in a line? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

code for leap year in a line?

give a code for leap year in a single line. surely u will use main function but not any other function. you may take arg from outside

26th Sep 2017, 5:48 AM
Ajinkya Pradiprao Deosarkar
Ajinkya Pradiprao Deosarkar - avatar
2 Answers
0
in python 3 def isleapyear(year): return (year % 4 == 0 and year % 100 != 0) or year % 400 == 0
26th Sep 2017, 6:17 AM
Arthur Queiroz Moura
Arthur Queiroz Moura - avatar
0
we can use ternary operaror
26th Sep 2017, 5:49 AM
Ajinkya Pradiprao Deosarkar
Ajinkya Pradiprao Deosarkar - avatar