Zaktualizuj 'labs02/task01.py'
This commit is contained in:
parent
4628385887
commit
495c499a92
@ -6,13 +6,17 @@ Zad 2. Napisz funkcję even_elements zwracającą listę,
|
||||
która zawiera tylko elementy z list o parzystych indeksach.
|
||||
"""
|
||||
|
||||
def even_elements(lista):
|
||||
pass
|
||||
def days_in_year(days):
|
||||
if ((days % 4) == 0 and ((days % 100) != 0)) or ((days % 400) == 0):
|
||||
dni=366
|
||||
else:
|
||||
dni=365
|
||||
|
||||
return dni
|
||||
|
||||
def tests(f):
|
||||
inputs = [[[1, 2, 3, 4, 5, 6]], [[]], [[41]]]
|
||||
outputs = [[1, 3, 5], [], [41]]
|
||||
inputs = [[2015], [2012], [1900], [2400], [1977]]
|
||||
outputs = [365, 366, 365, 366, 365]
|
||||
|
||||
for input, output in zip(inputs, outputs):
|
||||
if f(*input) != output:
|
||||
@ -20,6 +24,5 @@ def tests(f):
|
||||
break
|
||||
return "TESTS PASSED"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(tests(even_elements))
|
||||
print(tests(days_in_year))
|
||||
|
Loading…
Reference in New Issue
Block a user