dimanche 12 février 2017

"Cleaning up" basic Pig Latin translator in Python

Vote count: 0

As I am just a beginner, I made a small single-word Pig Latin translator in Python 3.5. I have my rough code that works, however I'd really like your opinions on how to make it more compact, pythonic, and "elegant" (i.e.-professional). Any help is appreciated, thank you!

#Converts a word into pig latin, needs to be cleaned up
def pig_latin(word):
    word = list(word)
    first_letter = word[0]
    del word[0]
    word.insert(len(word),first_letter)
    word.insert(len(word),'ay')
    print(''.join(word))

asked 23 secs ago

Let's block ads! (Why?)



"Cleaning up" basic Pig Latin translator in Python

Aucun commentaire:

Enregistrer un commentaire