0
Help me understand this please
You need to make a program to take a year as input and output "Leap year" if itâs a leap year, and "Not a leap year", if itâs not. To check whether a year is a leap year or not, you need to check the following: 1) If the year is evenly divisible by 4, go to step 2. Otherwise, the year is NOT leap year. 2) If the year is evenly divisible by 100, go to step 3. Otherwise, the year is a leap year. 3) If the year is evenly divisible by 400, the year is a leap year. Otherwise, it is not a leap year. Sample Input 2000 Sample Output Leap year Use the modulo operator % to check if the year is evenly divisible by a number.
3 Answers
+ 5
George James Bond , please go back some steps to the conditional statements :
if...
elif...
else..
please read the tutorial, do some small exercises and then try the challenge again.
happy coding and good success!
+ 3
What exactly is not clear to you?
+ 3
You do everything wrong âșïž
Carefully re-read the task, the answer is the task itself, you just need to rewrite it in Python, and do not write anything superfluous âșïž
Your value when dividing by 4, 100 and 400 should be without a remainder, but for some reason you are comparing the remainder with the number of days in a year đ
1. if year % 4 == 0:
2. if year % 100 == 0:
3. if year % 400 == 0:
Try to add the code yourself âșïž