From 495c499a92a13133516ee175e2c8cabaddaad190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Maliszewski?= Date: Wed, 13 Jun 2018 17:28:15 +0000 Subject: [PATCH] Zaktualizuj 'labs02/task01.py' --- labs02/task01.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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))