zrobione na zajeciach

This commit is contained in:
s352037 2018-05-13 12:45:02 +02:00
parent 9938591fa6
commit 6c10fb4b03
3 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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)]]

View File

@ -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]]