forked from tdwojak/Python2017
commited tasks
This commit is contained in:
parent
360ce4d88e
commit
442fd6891f
@ -9,11 +9,29 @@ na wielką. Np. pokemon_speak('pokemon') powinno zwrócić 'PoKeMoN'.
|
||||
|
||||
|
||||
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):
|
||||
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