Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pig_latin(word):
- new_words = []
- subject = word.split() # Creates a list of words. This works for individual words or sentences.
- for i in subject: # Iterates through split word
- first_letter = i[0]
- if first_letter in 'aeiou':
- pig_word = i + 'ay'
- new_words.append(pig_word) # Appends pic latin word
- else:
- pig_word = i[1:] + first_letter + 'ay'
- new_words.append(pig_word)
- print(' '.join(new_words)) # Prints content of new_words list. This is for printing sentences
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement