Leap Year? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Leap Year?

x = int(input() def leap_year(x): if x % 4 == 0: print(x) else: print("nope") leap_year(x) Keep getting an error message on line 2? It says error on "def"? I'm defining an input number which, when divided by 4 % == 0: so not sure why error? Any help appreciated:).

7th May 2019, 5:14 AM
tristach605
tristach605 - avatar
3 Answers
+ 1
Thanks Swim!
7th May 2019, 10:33 PM
tristach605
tristach605 - avatar
0
Tanks, Swim. Now they want it in boleen logic? Am I on the right track? Tested out okay. x = int(input()) print((x) % 4 == 0 and (x) % 100 != 0 and (x) % 400 == 0)
8th May 2019, 6:03 AM
tristach605
tristach605 - avatar
0
Changed name on stuff to match their request and everything went haywire:(. says shntax error on line 2? Any ideas what? year = int(raw_input()) def(raw_input): print ((year) % 4 == 0 or (year) % 100 != 0 or (year) % 400 != 0)
8th May 2019, 6:43 AM
tristach605
tristach605 - avatar