Zaktualizuj 'labs02/task07.py'

This commit is contained in:
Miłosz Maliszewski 2018-06-13 17:37:15 +00:00
parent 8fb40219cf
commit 472fbffb25

View File

@ -6,7 +6,16 @@ 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
sumujemy = 0
for znaki in text:
sumujemy = sumujemy + ord(znaki)
return sumujemy
def tests(f): def tests(f):
inputs = [["this is a string"], ["this is another string"]] inputs = [["this is a string"], ["this is another string"]]
@ -19,4 +28,4 @@ def tests(f):
return "TESTS PASSED" return "TESTS PASSED"
if __name__ == "__main__": if __name__ == "__main__":
print(tests(char_sum)) print(tests(char_sum))