forked from tdwojak/Python2017
commit
This commit is contained in:
parent
a0bb1a220b
commit
0f60618960
@ -7,8 +7,7 @@ która zawiera tylko elementy z list o parzystych indeksach.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def even_elements(lista):
|
def even_elements(lista):
|
||||||
pass
|
return lista[::2]
|
||||||
|
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [[[1, 2, 3, 4, 5, 6]], [[]], [[41]]]
|
inputs = [[[1, 2, 3, 4, 5, 6]], [[]], [[41]]]
|
||||||
@ -23,3 +22,4 @@ def tests(f):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(tests(even_elements))
|
print(tests(even_elements))
|
||||||
|
|
||||||
|
@ -5,8 +5,19 @@
|
|||||||
Napisz funkcję days_in_year zwracającą liczbę dni w roku (365 albo 366).
|
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):
|
def tests(f):
|
||||||
inputs = [[2015], [2012], [1900], [2400], [1977]]
|
inputs = [[2015], [2012], [1900], [2400], [1977]]
|
||||||
@ -20,3 +31,5 @@ def tests(f):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(tests(days_in_year))
|
print(tests(days_in_year))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user