Translation (used to be 'Moving around in a string')

Ryan Spencer jeder at earthlink.net
Sat Dec 6 14:20:58 EST 2003


Hello Again Everyone,

	As previously aforementioned in my post 'Moving around in a string', 
I've finally found my result to the pig_latin approach.

[start code]

import string

choice = raw_input("Would you like pig latin (p) or ubby dubby (u) translation? ")

sentence = raw_input("Please enter a sentence: ")

#Split up the sentence
words_within = sentence.split()

#Pig Latin
if choice == "p":
	
	words_within = sentence.split(" ")
	for word in words_within[0:]:
		pig_latin = word[1:]+word[0]+"ay"
		print pig_latin,

[end code]

Now all I have to find out how to do is find a vowel within the words of a
string and then do the ubbi dubbi thing (adding 'ub' after every spoken
vowel in a word it describes)

~Ryan




More information about the Python-list mailing list