forked from tdwojak/Python2018
zad 4, 8, 9
This commit is contained in:
parent
ebdd1865c9
commit
acf48c8e1e
@ -10,9 +10,7 @@ def sum_from_one_to_n(n):
|
|||||||
if n<1:
|
if n<1:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
for i in range(n+1):
|
return sum(range(1,n+1))
|
||||||
sum += i
|
|
||||||
return sum
|
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [[999], [-100]]
|
inputs = [[999], [-100]]
|
||||||
|
@ -7,7 +7,11 @@ przez 3 lub 5 mniejszych niż n.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def sum_div35(n):
|
def sum_div35(n):
|
||||||
pass
|
suma=0
|
||||||
|
for i in range(n):
|
||||||
|
if (n%3 ==0 or n%5 ==0):
|
||||||
|
suma += i
|
||||||
|
return(suma)
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [[10], [100], [3845]]
|
inputs = [[10], [100], [3845]]
|
||||||
|
@ -9,7 +9,11 @@ Np. leet('leet') powinno zwrócić '1337'.
|
|||||||
|
|
||||||
|
|
||||||
def leet_speak(text):
|
def leet_speak(text):
|
||||||
pass
|
text = text.replace('e', '3')
|
||||||
|
text = text.replace('l', '1')
|
||||||
|
text = text.replace('o', '0')
|
||||||
|
text = text.replace('t', '7')
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
|
Loading…
Reference in New Issue
Block a user