1
0
forked from tdwojak/Python2018

Update 'labs02/task09.py'

This commit is contained in:
Andrea Góralczyk 2018-06-02 20:02:05 +00:00
parent 4a42679729
commit c5944a3f95

View File

@ -7,10 +7,18 @@ na podobnie wyglądające cyfry: 'e' na '3', 'l' na '1', 'o' na '0', 't' na '7'.
Np. leet('leet') powinno zwrócić '1337'. Np. leet('leet') powinno zwrócić '1337'.
""" """
def leet_speak(text): def leet_speak(text):
pass
for i in range(len(text)):
if ((text[i]) == 'e'):
text = text[:i] + '3' + text[i + 1:]
elif ((text[i]) == 'l'):
text = text[:i] + '1' + text[i + 1:]
elif ((text[i]) == 'o'):
text = text[:i] + '0' + text[i + 1:]
elif ((text[i]) == 't'):
text = text[:i] + '7' + text[i + 1:]
return text
def tests(f): def tests(f):
inputs = [['leet'], ['do not want']] inputs = [['leet'], ['do not want']]