1
0
forked from tdwojak/Python2017
This commit is contained in:
s45159 2017-11-19 15:45:14 +01:00
parent a0bb1a220b
commit 0f60618960
2 changed files with 17 additions and 4 deletions

View File

@ -7,8 +7,7 @@ która zawiera tylko elementy z list o parzystych indeksach.
"""
def even_elements(lista):
pass
return lista[::2]
def tests(f):
inputs = [[[1, 2, 3, 4, 5, 6]], [[]], [[41]]]
@ -23,3 +22,4 @@ def tests(f):
if __name__ == "__main__":
print(tests(even_elements))

View File

@ -5,8 +5,19 @@
Napisz funkcję days_in_year zwracającą liczbę dni w roku (365 albo 366).
"""
def days_in_year(days):
pass
def days_in_year(year):
if year % 400 == 0:
return 366
elif year % 100 == 0:
return 365
elif year % 4 == 0:
return 366
else:
return 365
def tests(f):
inputs = [[2015], [2012], [1900], [2400], [1977]]
@ -20,3 +31,5 @@ def tests(f):
if __name__ == "__main__":
print(tests(days_in_year))