Pig Latin


# This program takes the following phrase:
# "The only thing we have to fear is fear itself"
# and adds "way" to words that start with vowels,
# and adds "ay" to words that start with consonants.


roosevelt = "The only thing we have to fear is fear itself"

# Separates each word and converts it to a list
roosevelt_as_list = roosevelt.split()

# New, empty list to store the results
results_for_roosevelt = []


vowels = "aeiou"
for word in roosevelt_as_list:
    if word[0] in vowels: #If the word starts with a vowel
        new_word = word + "way"
        results_for_roosevelt.append(new_word) #Append the modified word to the new list
    else: #If the word starts with a consonant
        new_word = word[1:] + word[0] + "ay" #Takes the first letter, moves it to the end of the word, then adds "ay"
        results_for_roosevelt.append(new_word)


# Converts the new list to a string
# The delimiter is " " so there are spaces between the words
final_sentence = (" ".join(results_for_roosevelt))

# capitalize() will capitalize the first word, but leave the rest lowercase
# results_for_roosevelt.capitalize() is not valid because capitalize() is used for strings, not lists
print(final_sentence.capitalize())