forked from tdwojak/Python2017
done
This commit is contained in:
parent
d5755b6965
commit
9e7ad31f19
@ -7,7 +7,8 @@ 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):
|
||||||
|
@ -5,9 +5,11 @@
|
|||||||
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):
|
def days_in_year(year):
|
||||||
pass
|
if year % 4==0 and year % 100!=0 or year % 400 == 0:
|
||||||
|
return 366
|
||||||
|
else:
|
||||||
|
return 365
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [[2015], [2012], [1900], [2400], [1977]]
|
inputs = [[2015], [2012], [1900], [2400], [1977]]
|
||||||
outputs = [365, 366, 365, 366, 365]
|
outputs = [365, 366, 365, 366, 365]
|
||||||
@ -20,3 +22,8 @@ def tests(f):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(tests(days_in_year))
|
print(tests(days_in_year))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#jest podzielny przez 4, ale nie jest podzielny przez 100
|
||||||
|
#jest podzielny przez 400
|
@ -13,9 +13,19 @@ jak 'set', która przechowuje elementy bez powtórzeń.)
|
|||||||
|
|
||||||
|
|
||||||
def oov(text, vocab):
|
def oov(text, vocab):
|
||||||
pass
|
s = set()
|
||||||
|
for czajnik in text.split():
|
||||||
|
if czajnik not in vocab:
|
||||||
|
s.add(czajnik.lower())
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
text = [("this is a string , which i will use for string testing",
|
||||||
|
[',', 'this', 'is', 'a', 'which', 'for', 'will', 'i'])]
|
||||||
|
vocab = [['string', 'testing', 'use']]
|
||||||
|
|
||||||
|
oov("this is a string , which i will use for string testing",
|
||||||
|
[',', 'this', 'is', 'a', 'which', 'for', 'will', 'i'])
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [("this is a string , which i will use for string testing",
|
inputs = [("this is a string , which i will use for string testing",
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
|
|
||||||
|
|
||||||
def suma(a, b):
|
def suma(a, b):
|
||||||
"""
|
return a+b
|
||||||
Napisz funkcję, która zwraca sumę elementów.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [(2, 3), (0, 0), (1, 1)]
|
inputs = [(2, 3), (0, 0), (1, 1)]
|
||||||
@ -20,3 +19,4 @@ def tests(f):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(tests(suma))
|
print(tests(suma))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user