0

Hi friends i'm solving problem 23.2 in python for beginners and i can't figure out what's wrong with my code

year = int(input()) if year %4==0: print ("Not a Leap year") elif year%100!= 0: print ("Not a Leap year") else: if year% 400 == 0: print ("Leap year")

12th Oct 2021, 12:44 AM
Kelbis Hernandez
Kelbis Hernandez - avatar
1 Resposta
0
Years that are divisible by 400 are also divisible by 100. Once a year satisfies your second condition, it won't go on to the third. Therefore you need to check if a year is divisible by 400 before checking that it's divisible by 100.
12th Oct 2021, 2:46 AM
Josiah Mathieu
Josiah Mathieu - avatar