# Start writing code here...
def prefix_check(pre_list, words):
prefix_index = 100000
root = ""
root_list = []
for word in words:
for prefix in pre_list:
prefix_index = word.lower().find(prefix)
if prefix_index == -1:
pass
elif prefix_index == 0:
root = word[len(prefix):]
root_list.append(root)
else:
pass
return root_list
sentence = "We should prepopulate the pregame and postgame parties before the postmortem."
prefixes = ['pre','post', 're']
for letters in sentence:
if letters.isalpha():
pass
elif letters == " ":
pass
else:
sentence = sentence.replace(letters, "")
word_list = sentence.split()
print(sentence)
roots = prefix_check(prefixes, word_list)
print("The roots of the words with prefixes in this sentence are:", roots)