0
0
Fork 0

zrobiono zadanie 7

This commit is contained in:
Michał Jaskuła 2018-06-02 09:39:07 +00:00
parent 41207a9a35
commit 05f21a640c
1 changed files with 4 additions and 1 deletions

View File

@ -6,7 +6,10 @@ 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 znak in text:
suma = suma + ord(znak)
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"]]