diff --git a/labs02/task01.py b/labs02/task01.py index 7c08c56..e6b56ba 100644 --- a/labs02/task01.py +++ b/labs02/task01.py @@ -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))