From a946cb82daebd1c82f7eb7a76ac6877338a075b3 Mon Sep 17 00:00:00 2001 From: s45147 Date: Sun, 19 Nov 2017 15:40:09 +0100 Subject: [PATCH] done --- labs02/task04.py | 2 +- labs02/task05.py | 5 +++-- labs02/task10.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/labs02/task04.py b/labs02/task04.py index 4be29e7..08d4cc0 100644 --- a/labs02/task04.py +++ b/labs02/task04.py @@ -10,7 +10,7 @@ def sum_from_one_to_n(n): suma = 0 for i in range(n+1): - suma = suma + i + suma = suma + i if n < 1: return 0 else: diff --git a/labs02/task05.py b/labs02/task05.py index f59268a..961e7eb 100644 --- a/labs02/task05.py +++ b/labs02/task05.py @@ -8,9 +8,10 @@ dwoma punktami przestrzeni trójwymiarowej. Punkty są dane jako trzyelementowe listy liczb zmiennoprzecinkowych. np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5. """ - +from math import sqrt def euclidean_distance(x, y): - pass + + return sqrt(sum((x - y) ** 2 for x, y in zip(x, y))) def tests(f): inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]] diff --git a/labs02/task10.py b/labs02/task10.py index f380f0a..58d40d2 100644 --- a/labs02/task10.py +++ b/labs02/task10.py @@ -13,7 +13,7 @@ def pokemon_speak(text): def tests(f): - inputs = [['pokemon'], ['do not want'], 'POKEMON'] + inputs = [['pokemon'], ['do not want'], ['POKEMON']] outputs = ['PoKeMoN', 'Do nOt wAnT', 'POKEMON'] for input, output in zip(inputs, outputs):