1
0
forked from tdwojak/Python2017

commited tasks

This commit is contained in:
s45150 2017-11-26 15:05:03 +01:00
parent 360ce4d88e
commit 442fd6891f

View File

@ -9,11 +9,29 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'.
def pokemon_speak(text): def pokemon_speak(text):
pass #spacja Asci 32
text_tmp = str(text)
text_tmp = text_tmp.replace('[', '')
text_tmp = text_tmp.replace(']', '')
text_tmp = text_tmp.replace("'", '')
lista_temp = ""
j = 1
for i in text:
if ord(i) == 32:
j=1
lista_temp += i
else:
if j%2 == 0:
lista_temp += i
else:
lista_temp += i.upper()
j += 1
return lista_temp
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):