19 lines
381 B
Python
19 lines
381 B
Python
|
|
def is_year_leap(year):
|
||
|
|
if year % 4 == 0:
|
||
|
|
return True
|
||
|
|
else:
|
||
|
|
return False
|
||
|
|
|
||
|
|
test_data = [1901, 2000, 2016, 1987]
|
||
|
|
|
||
|
|
test_result = [False, True, True, False]
|
||
|
|
|
||
|
|
for i in range(len(test_data)):
|
||
|
|
yr = test_data[i]
|
||
|
|
print(yr, "->", end="")
|
||
|
|
resutl = is_year_leap(yr)
|
||
|
|
|
||
|
|
if resutl == test_result[i]:
|
||
|
|
print("OK")
|
||
|
|
else:
|
||
|
|
print("Failed")
|