# this example is similar # to the double dutch generator def createDoubleDutch(word): ''' create and return a double dutch version of word ''' for v in ("a", "e", "i", "o", "u", "y"): # double dutch-ize each vowel word = word.replace(v, v+"b"+v) return word if __name__ == '__main__': ddSentence = "" for w in "My sample sentence for double dutch".split(' '): ddSentence += createDoubleDutch(w) + " " print ddSentence.strip() #output: # Myby sabamplebe sebentebencebe fobor doboubublebe dubutch
A python example based blog that shows how to accomplish python goals and how to correct python errors.
Tuesday, September 29, 2009
Python - generate double dutch
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment