For example, given the sentence "Bob is American. I love him." When I enter "American 2", I want to extract Bob, is/I love with 2 words each.
So far, I've only typed certain words like the code below, so I don't know what to do in the future.
for i in sen:
word = input ("Enter a word to search for".\n")
if word in sen:
result = word
print("{0} is found".format(word))
else:
print("Not found")
Thank you for reading my question.
python
© 2024 OneMinuteCode. All rights reserved.