I want to make a function that takes in a string text
and an array words
and then compare the string with the array and removes all the words in the string that occurs in the words
-array.
Example:
remove = ["first",
"second",
"third",
"fourth",
"fifth",
"sixt",
"seventh",
"eigth",
"ninth",
"tenth",
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday",
"$"]
def preprocess(text, words):
text = text.lower()
if text in words... #Not sure what to do here...
myString = "I got second in todays competition"
preprocess(myString, remove)
#Should return: "I got in todays competition"