forked from tdwojak/Python2018
rozwiazanie zadania od 7 do 8
This commit is contained in:
parent
2e4c0027c8
commit
d032993997
@ -6,7 +6,12 @@ Napisz funkcję char_sum, która dla zadanego łańcucha zwraca
|
|||||||
sumę kodów ASCII znaków.
|
sumę kodów ASCII znaków.
|
||||||
"""
|
"""
|
||||||
def char_sum(text):
|
def char_sum(text):
|
||||||
pass
|
suma = 0
|
||||||
|
for i in text:
|
||||||
|
suma += ord(i)
|
||||||
|
return suma
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [["this is a string"], ["this is another string"]]
|
inputs = [["this is a string"], ["this is another string"]]
|
||||||
|
@ -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 i % 3 == 0 or i % 5 == 0:
|
||||||
|
suma += i
|
||||||
|
return suma
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [[10], [100], [3845]]
|
inputs = [[10], [100], [3845]]
|
||||||
|
Loading…
Reference in New Issue
Block a user