- 1
Leap year
A year is a leap year if it is divisible by 4, except it is divisible by 100, but it is a leap year when it is divisible by 400.Write a program that asks the user for a year and prints out if the year is a leap year or not
3 ответов
+ 6
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
print("leap year")
else:
print("not a leap year")
0
That's correct
0
year = int(input())
if(year%4 == 0):
if(year%100 == 0):
if(year%400 == 0):
print("Leap year")
else:
print("Not a leap year")
else:
print("Leap year")
else:
print ("Not a leap year")