Vusa Moyo wrote:

> I've written a script to remove vowels from a string/sentence.
> 
> the while loop I'm using below is to take care of duplicate vowels found
> in a sentence, ie
> 
> anti_vowel('The cow moos louder than the frog')
> 
> It works, but obviously its messy and n00by. Any suggestions on how I can
> write this code better?

(I'm assuming Python3)

>>> 'The cow moos louder than the frog'.translate(str.maketrans("", "", 
"aeiouAEIOU"))
'Th cw ms ldr thn th frg'


_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to