Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sentence = input("Enter a sentence: ")
- keyword = input("Input a keyword from the sentence: ")
- words = sentence.split()
- found = False
- for i, word in enumerate(words, 1):
- if keyword.lower() == word.lower():
- print("This word appears in sentence in position", i)
- found = True
- if not found:
- print("not in sentence")
Add Comment
Please, Sign In to add comment