From 73ec835b5eea710365b92ba76601fec3430fd710 Mon Sep 17 00:00:00 2001 From: puderniczka Date: Sat, 2 Jun 2018 22:57:30 +0200 Subject: [PATCH] task10, task11, test_task done --- labs02/task10.py | 13 ++++++++++++- labs02/task11.py | 12 +++++++++++- labs02/test_task.py | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/labs02/task10.py b/labs02/task10.py index 58d40d2..52beea2 100644 --- a/labs02/task10.py +++ b/labs02/task10.py @@ -9,7 +9,18 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'. def pokemon_speak(text): - pass + w = '' + for i in range(len(text)): + if i % 2 == 0: + w += text[i].upper() + else: + w += text[i] + #print w + return w + + + + def tests(f): diff --git a/labs02/task11.py b/labs02/task11.py index 7d36767..004b95a 100644 --- a/labs02/task11.py +++ b/labs02/task11.py @@ -9,7 +9,17 @@ Oba napisy będą składać się wyłacznie z małych liter. """ def common_chars(string1, string2): - pass + lista = [] + for a in range(97,123,1): + if chr(a) in string1 and chr(a) in string2: + lista.append(chr(a)) + print lista + return lista + + + #print(cmp(string1, string2)) + #ord(string2) + print(ord('a'), 'do', ord('z')) def tests(f): diff --git a/labs02/test_task.py b/labs02/test_task.py index 88b1fe6..6875a37 100755 --- a/labs02/test_task.py +++ b/labs02/test_task.py @@ -6,7 +6,7 @@ def suma(a, b): """ Napisz funkcję, która zwraca sumę elementów. """ - return 0 + return a + b def tests(f): inputs = [(2, 3), (0, 0), (1, 1)]