1
0
forked from tdwojak/Python2017

task10 passed

This commit is contained in:
Ewelina 2017-11-27 20:42:58 +01:00
parent cd3004f071
commit 111f6b336d

View File

@ -7,13 +7,23 @@ Napisz funkcję pokemon_speak, która zamienia w podanym napisie co drugą liter
na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'. na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'.
""" """
def pokemon_speak(text): def pokemon_speak(text):
pass txtstr= ''
if text.isupper():
return(text)
else:
for i in range (len(text)):
if (i % 2 == 0):
txtstr +=text[i].upper()
else:
txtstr += text[i]
return(txtstr)
def tests(f): def tests(f):
inputs = [['pokemon'], ['do not want'], 'POKEMON'] inputs = [['pokemon'], ['do not want'], ['POKEMON']]
outputs = ['PoKeMoN', 'Do nOt wAnT', 'POKEMON'] outputs = ['PoKeMoN', 'Do nOt wAnT', 'POKEMON']
for input, output in zip(inputs, outputs): for input, output in zip(inputs, outputs):