I have multiple string variables that store some text data. I want to perform the same set of tasks on all strings. How can I achieve this in Python?
string_1 = "this is string 1" string_2 = "this is string 2" string_3 = "this is string 3" for words in string_1: return the second word Above is just an example. I want to extract the second word in every string. Can I do something like:
for words in [string_1, string_2, string_3]: return the second word in each string