From c9dd223315058a54f4e894f7185cdbbc47362382 Mon Sep 17 00:00:00 2001 From: puderniczka Date: Sat, 2 Jun 2018 22:13:16 +0200 Subject: [PATCH] task06, task07 done --- labs02/task06.py | 9 ++++++++- labs02/task07.py | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/labs02/task06.py b/labs02/task06.py index ff4a9d3..a012606 100644 --- a/labs02/task06.py +++ b/labs02/task06.py @@ -10,7 +10,14 @@ ma być zwracany napis "It's not a Big 'No!'". """ def big_no(n): - pass + if n < 5: + return "It's not a Big 'No!'" + w = 'N' + for i in range(n): + w += 'O' + w += '!' + return w + def tests(f): inputs = [[5], [6], [2]] diff --git a/labs02/task07.py b/labs02/task07.py index 80cbd37..56c9551 100644 --- a/labs02/task07.py +++ b/labs02/task07.py @@ -6,7 +6,11 @@ Napisz funkcję char_sum, która dla zadanego łańcucha zwraca sumę kodów ASCII znaków. """ def char_sum(text): - pass + suma = 0 + for a in text: + suma += ord(a) + #print suma + return suma def tests(f): inputs = [["this is a string"], ["this is another string"]]