1
0
Fork 0

Update zadania

This commit is contained in:
Tomasz Dwojak 2017-11-19 10:42:39 +01:00
parent 4f5cf71dd1
commit 795f2a1bc7
6 changed files with 20 additions and 6 deletions

View File

@ -112,6 +112,13 @@
" \n", " \n",
" Motywacje zaczerpnięte m.in. z [5 Reasons why Python is Powerful Enough for Google](https://www.codefellows.org/blog/5-reasons-why-python-is-powerful-enough-for-google)." " Motywacje zaczerpnięte m.in. z [5 Reasons why Python is Powerful Enough for Google](https://www.codefellows.org/blog/5-reasons-why-python-is-powerful-enough-for-google)."
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

View File

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Zad 4. Napisz funkcje oov(text, vocab), która zwraca listę wyrazów Zad 4. Napisz funkcje oov(text, vocab), która zwraca listę wyrazów
@ -15,8 +18,8 @@ def oov(text, vocab):
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",
[',', 'this', 'is', 'a', 'which', 'for', 'will', 'I'])] [',', 'this', 'is', 'a', 'which', 'for', 'will', 'i'])]
outputs = [['string', 'testing', 'use']] outputs = [['string', 'testing', 'use']]
for input, output in zip(inputs, outputs): for input, output in zip(inputs, outputs):

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Napisz funkcję sum_from_one_to_n zwracającą sume liczb od 1 do n. Napisz funkcję sum_from_one_to_n zwracającą sume liczb od 1 do n.

View File

@ -6,6 +6,7 @@
Napisz funkcję euclidean_distance obliczającą odległość między Napisz funkcję euclidean_distance obliczającą odległość między
dwoma punktami przestrzeni trójwymiarowej. Punkty dane jako dwoma punktami przestrzeni trójwymiarowej. Punkty dane jako
trzyelementowe listy liczb zmiennoprzecinkowych. trzyelementowe listy liczb zmiennoprzecinkowych.
np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5.
""" """
def euclidean_distance(x, y): def euclidean_distance(x, y):

View File

@ -4,7 +4,8 @@
""" """
Napisz funkcję common_chars(string1, string2), która zwraca alfabetycznie Napisz funkcję common_chars(string1, string2), która zwraca alfabetycznie
uporządkowaną listę wspólnych znaków z lańcuchów string1 i string2. uporządkowaną listę wspólnych liter z lańcuchów string1 i string2.
Oba napisy będą składać się wyłacznie z małych liter.
""" """
def common_chars(string1, string2): def common_chars(string1, string2):
@ -12,8 +13,8 @@ def common_chars(string1, string2):
def tests(f): def tests(f):
inputs = [["this is a string", "Ala ma kota"]] inputs = [["this is a string", "ala ma kota"]]
outputs = [[' ', 'a', 't']] outputs = [['a', 't']]
for input, output in zip(inputs, outputs): for input, output in zip(inputs, outputs):
if f(*input) != output: if f(*input) != output:

View File

@ -6,7 +6,7 @@ def suma(a, b):
""" """
Napisz funkcję, która zwraca sumę elementów. Napisz funkcję, która zwraca sumę elementów.
""" """
pass return a + b
def tests(f): def tests(f):
inputs = [(2, 3), (0, 0), (1, 1)] inputs = [(2, 3), (0, 0), (1, 1)]