From 3fc2e3d36fd375300c7585435b422d0136985bd2 Mon Sep 17 00:00:00 2001 From: Mikaszaaa Date: Wed, 30 May 2018 11:37:18 +0200 Subject: [PATCH] zadanie 10-11 --- labs02/task10.py | 9 ++++++++- labs02/task11.py | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/labs02/task10.py b/labs02/task10.py index 58d40d2..da4b44b 100644 --- a/labs02/task10.py +++ b/labs02/task10.py @@ -9,7 +9,14 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'. def pokemon_speak(text): - pass + lista = [] + for i in range(len(text)): + if i % 2 == 0: + lista.append(text[i].upper()) + else: + lista.append(text[i]) + text = "".join(lista) + return text def tests(f): diff --git a/labs02/task11.py b/labs02/task11.py index 7d36767..261b387 100644 --- a/labs02/task11.py +++ b/labs02/task11.py @@ -9,7 +9,19 @@ Oba napisy będą składać się wyłacznie z małych liter. """ def common_chars(string1, string2): - pass + lista = [] + result = [] + for i in range(len(string1)): + lista.append(string1[i]) + for j in range(len(string2)): + if string2[j] in lista: + result.append(string2[j]) + nowa = list(set(result)) + for i in nowa: + if ord(i) == 32: + nowa.remove(i) + nowa.sort() + return nowa def tests(f):