# Project Goal. Identify the roots of words with common prefixes, 
# Strip the prefixes from the roots and save the roots in a separate list
# Print the roots that remain.# Start writing code here...
def prefix_check(pre_list, words):
    root_list = []
    for word in words:
        for prefix in pre_list:
            if prefix in word[0:len(prefix)]:
                word = word.replace(prefix, "")
                root_list.append(word)
            else:
                pass
    return root_list
sentence = "We should prepopulate the pregame and postgame parties before the postmortem."
prefixes = ['pre','post', 're']
word_list = []
for letter in sentence:
    if letter.isalpha():
        pass
    else:
        if letter == " ":
            pass
        else:
            sentence = sentence.replace(letter, "")
word_list = sentence.split()
print(prefix_check(prefixes, word_list))
print(word_list)
        
####--------------------------PREFIX_CHECK FUNCTION-------------------------------------------------#########
#write a function called prefix_check that accepts the list prefixes and the list of word_list
# follow the flow chart for the development of this list
# return roots_list to the function call for printing.
####----------------------------PROGRAM FLOW---------------------------------------------------------########
sentence = "We should prepopulate the pregame and postgame parties before the postmortem." # use this sentence to test your code
prefixes = ['pre','post', 're']  # use the prefixes for this activity
#strip any punctuation from the sentence, but leave the spaces--this is so we get words only when we convert it to a list
# Change the sentence into a list of words called word_list; remember,there should be no punctuation here--it should
# have been removed in the previous step.
# Take each word in word_list and check to see if it has any of the roots in it that you iterate over to see if they meet the qualifications below
# create a function call prefix check which has two parameters:  pre_list and word_list (your function should be at the top of the program)
# pre_list contains the values passed from the prefix list and words contains the values passed from word list
# print the return value from the function (which will be a list of roots that are from the sentence)