Skip to main content
added 36 characters in body
Source Link
V.i.K.i
  • 189
  • 1
  • 17

Yes you could do

for sentence in [string_1, string_2, string_3]:   return print(sentence.split(' ')[1]) # Get second word and do something with it 

This will work assuming that you have minimum of two words in the string and each separated by a space.

Yes you could do

for sentence in [string_1, string_2, string_3]:   return sentence.split(' ')[1] 

This will work assuming that you have minimum of two words in the string and each separated by a space.

Yes you could do

for sentence in [string_1, string_2, string_3]: print(sentence.split(' ')[1]) # Get second word and do something with it 

This will work assuming that you have minimum of two words in the string and each separated by a space.

Source Link
V.i.K.i
  • 189
  • 1
  • 17

Yes you could do

for sentence in [string_1, string_2, string_3]: return sentence.split(' ')[1] 

This will work assuming that you have minimum of two words in the string and each separated by a space.