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