0

I'm making a program that identifies the word position in a sentence.

For example, in the sentence
ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR COUNTRY

The word 'COUNRTY' appears in the 5th and 17th positions.

This is what I have so far. Any ideas for what I can add on please?

varSentence =  input("Enter the sentence")

print (varSentence)

varWord = input("Enter word ")

import time
time.sleep(1)
print('Please wait')

varSplit = varSentence.split()

import time
time.sleep(1)
if varWord in varSplit:


        print ("Found word")


else:
    print ("Error word not found.Try again")

Edited by nic56208

2
Contributors
1
Reply
33
Views
11 Months
Discussion Span
Last Post by Gribouillis
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.