6 Answers

New AnswerNemezio Lopezperez I sent you a DM with a code that reflects the challenge line for line. I hope it helps you understand the underlying concept of the challenge

Last part of if has to be ... or year%400==0: With and it can never be true Code with testing: def leap(year): if year % 4 == 0 and year % 100 != 0 or year % 400 == 0: print("Leap year") else: print("Not a leap year") for y in range(395,405): print(y, end=' ') leap(y) for y in range(495,505): print(y, end=' ') leap(y)

Hi guys! Trying to solve this problem for Phython but not finding a way to get through it, maybe someone could help? Much appreciated ππͺπ 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.

Hey yes this was my attempt: if year % 4 == 0 and year % 100 != 0 and year % 400 == 0: print("Leap year") else: print("Not a leap year")