# 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...
####--------------------------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)
def prefix_check(pre_list, words):
root_list = []
for word in words:
for prefix in pre_list:
if prefix.lower() in word:
if word.find(prefix) == 0:
root_list.append(word.replace(prefix, ""))
else:
pass
else:
pass
return root_list
sentencee = "We should prepopulate the pregame and postgame parties before the postmortem."
sentence = "We shouldn't prepopulate the prepardedness of the prepy kids outside the postgame or postmortem or postulation and the return of the reapear"
prefixes = ['pre','post', 're']
sentence = sentence.replace(".", "")
word_list = sentence.split()
roots = prefix_check(prefixes, word_list)
print("This are the following words in your sentence that contained prefixes:",roots)