I have been asked to locate where an input word appears in a sentence. I have figured out how to make it case insensitive and chosen which word to find but I am having trouble getting it to print the positions of the word. Here is what I have:
enter code here
sntc = input("Please type in a sentence without punctuation:")
print("This is the sentence you input:",sntc)
wrd = input("Please enter a word you want to search for in the sentence:")
print("The word requested to be seacrhed for is:",wrd)
sntcLow = sntc.lower()
wrd1 = wrd.lower()
SenLst = []
SenLst.append(sntcLow)
print(SenLst)
if any(wrd1 in s for s in SenLst):
print("Search successful. The word '",wrd1,"' has been found in position(s):")
else:
print("Search unsuccessful. The word '",wrd1,"' was not found. Please try another word...")