From 4be2ec1074358243f7dd04001ac1cfdb5e3afe4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Maliszewski?= Date: Wed, 13 Jun 2018 17:39:27 +0000 Subject: [PATCH] Zaktualizuj 'labs02/task10.py' --- labs02/task10.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/labs02/task10.py b/labs02/task10.py index 58d40d2..d25bc9f 100644 --- a/labs02/task10.py +++ b/labs02/task10.py @@ -9,8 +9,16 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'. def pokemon_speak(text): - pass + listy = [] + for i in range(len(text)): + if i % 2 == 0: + listy.append(text[i].upper()) + else: + listy.append(text[i]) + + return ''.join(listy) + def tests(f): inputs = [['pokemon'], ['do not want'], ['POKEMON']] @@ -23,4 +31,4 @@ def tests(f): return "TESTS PASSED" if __name__ == "__main__": - print(tests(pokemon_speak)) + print(tests(pokemon_speak)) \ No newline at end of file