Jan-14-2018, 05:59 PM
This is just a function that translates text to the Ab language. I've included two tests for it.
The test output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
def convert_to_ab(text): temp = '' for char in text: if char in [ 'a' , 'e' , 'i' , 'o' , 'u' , 'y' ]: temp + = ( 'ab' + char) elif char in [ 'A' , 'E' , 'I' , 'O' , 'U' , 'Y' ]: temp + = ( 'Ab' + char.lower()) else : temp + = char return temp text = "This is a test. Do not adjust your jockstrap. This is only a test." text2 = "Now is the time for all good men to come to the aid of the Party." print (convert_to_ab(text)) print (convert_to_ab(text2)) |
1 2 |
Thabis abis aba tabest. Dabo nabot abadjabust abyaboabur jabockstrabap. Thabis abis abonlaby aba tabest. Nabow abis thabe tabimabe fabor aball gaboabod maben tabo cabomabe tabo thabe abaabid abof thabe Pabartaby. |