apache pig - Program in Python -


this question has answer here:

this code have make pig-latin translator , can't seem translate, have tips make work?

i think issue within encode , starts vowel parts can't seem figure out.

adjust these 3 functions:

def starts_with_vowel(word):     # return true if word starts vowel , false otherwise     return word[0] in ['a', 'e', 'i', 'o', 'u']  def encode(word):     # translate single word secret language     # call starts vowel decide pattern follow     if starts_with_vowel(word):         return word[1:] + word[0] + 'ar'     else:         return word + 'way'  def translate(message):     # translate whole text secret language     # call encode translate individual words in text     return ' '.join(encode(word) word in message) 

the biggest problem in encode() , starts_with_vowel() iterating through words (but comment says should work on single word)


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -