task10 passed
This commit is contained in:
parent
cd3004f071
commit
111f6b336d
@ -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'.
|
||||
"""
|
||||
|
||||
|
||||
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):
|
||||
inputs = [['pokemon'], ['do not want'], 'POKEMON']
|
||||
inputs = [['pokemon'], ['do not want'], ['POKEMON']]
|
||||
outputs = ['PoKeMoN', 'Do nOt wAnT', 'POKEMON']
|
||||
|
||||
for input, output in zip(inputs, outputs):
|
||||
|
Loading…
Reference in New Issue
Block a user