forked from tdwojak/Python2018
zrobione na zajeciach
This commit is contained in:
parent
9938591fa6
commit
6c10fb4b03
@ -10,7 +10,7 @@ def sum_from_one_to_n(n):
|
|||||||
if n > 1:
|
if n > 1:
|
||||||
wynik = 0
|
wynik = 0
|
||||||
for i in range(n+1):
|
for i in range(n+1):
|
||||||
wynik = i + wynik
|
wynik += i
|
||||||
return wynik
|
return wynik
|
||||||
else: return 0
|
else: return 0
|
||||||
pass
|
pass
|
||||||
|
@ -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):
|
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):
|
def tests(f):
|
||||||
inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]]
|
inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]]
|
||||||
|
@ -10,7 +10,11 @@ ma być zwracany napis "It's not a Big 'No!'".
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def big_no(n):
|
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):
|
def tests(f):
|
||||||
inputs = [[5], [6], [2]]
|
inputs = [[5], [6], [2]]
|
||||||
|
Loading…
Reference in New Issue
Block a user