I have this line of code right now, it currently translates the normal word correctly. But I need to be able to remove a period from the end of the word, translate the word, then add the period to the end of the word.
def translateWordToPigLatin(word):
translatedWord = ""
if len(word) > 0:
# If word is a number...
if word.isdigit():
return word
# end if
# If first letter is a vowel...
if word[0].lower() in vowels:
# print("Word begins with a vowel.") # Do vowel stuff
translatedWord = word + 'yay'
else: # If first letter is a consonant...
# print("Word begins with a consonant.") # Do consonant stuff
translatedWord = word[1:] + word[0] + "ay"
# end if
# end if
return translatedWord.capitalize()