# create a tuple with vowels....yes I include y as a vowel vowels = 'a', 'e', 'i', 'o', 'u', 'y' # movie quote for our sentence sentence = "My name is Werner Brandes, my voice is my password, verify me." # iterate through the tuple of vowels for vowel in vowels: # replace the vowel with nothing sentence = sentence.replace(vowel, '') # display the vowel-less sentence! print sentence 'M nm s Wrnr Brnds, m vc s m psswrd, vrf m.' # additional string functions: http://docs.python.org/library/stdtypes.html # manipulate vowels to create pig latin or double dutch
A python example based blog that shows how to accomplish python goals and how to correct python errors.
Friday, July 10, 2009
Python remove vowels from a sentence
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment