311.csv #1

Open
s354567 wants to merge 17 commits from s354567/Python2018:master into master
Showing only changes of commit 495c499a92 - Show all commits

View File

@ -6,13 +6,17 @@ Zad 2. Napisz funkcję even_elements zwracającą listę,
która zawiera tylko elementy z list o parzystych indeksach. która zawiera tylko elementy z list o parzystych indeksach.
""" """
def even_elements(lista): def days_in_year(days):
pass if ((days % 4) == 0 and ((days % 100) != 0)) or ((days % 400) == 0):
dni=366
else:
dni=365
return dni
def tests(f): def tests(f):
inputs = [[[1, 2, 3, 4, 5, 6]], [[]], [[41]]] inputs = [[2015], [2012], [1900], [2400], [1977]]
outputs = [[1, 3, 5], [], [41]] outputs = [365, 366, 365, 366, 365]
for input, output in zip(inputs, outputs): for input, output in zip(inputs, outputs):
if f(*input) != output: if f(*input) != output:
@ -20,6 +24,5 @@ def tests(f):
break break
return "TESTS PASSED" return "TESTS PASSED"
if __name__ == "__main__": if __name__ == "__main__":
print(tests(even_elements)) print(tests(days_in_year))