1
0
forked from tdwojak/Python2018

rozwiazanie zadania od 7 do 8

This commit is contained in:
s434579 2018-05-13 12:54:36 +02:00
parent 2e4c0027c8
commit d032993997
2 changed files with 11 additions and 2 deletions

View File

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

View File

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