From 472fbffb2555d08ea7a98620c074d73e5af51796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Maliszewski?= Date: Wed, 13 Jun 2018 17:37:15 +0000 Subject: [PATCH] Zaktualizuj 'labs02/task07.py' --- labs02/task07.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/labs02/task07.py b/labs02/task07.py index 80cbd37..e922ef2 100644 --- a/labs02/task07.py +++ b/labs02/task07.py @@ -6,7 +6,16 @@ Napisz funkcję char_sum, która dla zadanego łańcucha zwraca sumę kodów ASCII znaków. """ def char_sum(text): - pass + + sumujemy = 0 + + for znaki in text: + + sumujemy = sumujemy + ord(znaki) + + + return sumujemy + def tests(f): inputs = [["this is a string"], ["this is another string"]] @@ -19,4 +28,4 @@ def tests(f): return "TESTS PASSED" if __name__ == "__main__": - print(tests(char_sum)) + print(tests(char_sum)) \ No newline at end of file