diff --git a/labs02/task04.py b/labs02/task04.py index 99ce033..df2493d 100644 --- a/labs02/task04.py +++ b/labs02/task04.py @@ -10,7 +10,7 @@ def sum_from_one_to_n(n): if n > 1: wynik = 0 for i in range(n+1): - wynik = i + wynik + wynik += i return wynik else: return 0 pass diff --git a/labs02/task05.py b/labs02/task05.py index f59268a..69c9138 100644 --- a/labs02/task05.py +++ b/labs02/task05.py @@ -10,7 +10,11 @@ np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5. """ def euclidean_distance(x, y): - pass + sum = 0 + for i in range(len(x)): + sum += ((x[i]-y[i])**2) + distance = sum ** (1/2) + return distance def tests(f): inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]] diff --git a/labs02/task06.py b/labs02/task06.py index ff4a9d3..0f57c7b 100644 --- a/labs02/task06.py +++ b/labs02/task06.py @@ -10,7 +10,11 @@ ma być zwracany napis "It's not a Big 'No!'". """ def big_no(n): - pass + string = "NO!" + if n >= 5: + napis = string[0]+string[1]*n+string[2] + return napis + else: return "It's not a Big 'No!'" def tests(f): inputs = [[5], [6], [2]]