So I have this string, and I'm iterating over a list of substrings to remove. In Ruby, where strings are mutable, I would just be able to keep changing the original string in place. But I'm running into issues figuring this out due to strings being immutable in Python.
If this is my string, and I'm trying to remove substrings in the following list (times):
string = "Play soccer tomorrow from 2pm to 3pm @homies"
times = ['tomorrow', 'from 2pm to 3pm']
How do I get this string as the desired return?
removed_times = "Play soccer @homies"
Edit: different from suggested questions b/c of multiple substrings
aandbbfrom the stringcbabc? After removinga, the twobs will be adjacent, but perhaps you don't want to remove them becausebbwas not a substring of the original string.