code for leap year in a line? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
- 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 Réponses
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