Decompose and Attempt Task 1

#Develop a program that analyses a sentence that contains several words without punctuation. When a word in that sentence is input, the program identifies all of the positions where the word occurs in the sentence. The system should not be case sensitive: Ask, ask, ASK should be treated as the same word.

the sentence is provided for you 

"ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR COUNTRY"

We need a method of splitting the words into a LIST - lists are indexed structures so this will work for us to get the position. 

Try not to use GLOBAL VARIABLES - you can PASS PARAMETERS it is better practice.

Write a definition (function) to take a sentence as a parameter and split it to a list - return the list. 

You can split to a list using the useful  .split command.   

Can you write the Main () definition to use the code above. 

You need to declare the variable for sentence and the wordsList and then pass the sentence to this function as a parameter. 

Use a print statement to prove it has worked for you. 

Only use this code if you are having trouble working it out

Next we need to be able to get the user to enter a word then tell them the position (1 to whatever it is) the word is in.  - if it is in more than one position then output each position. it is in. 

You can use wordlist.index(word) to find an index - but what about duplicate words? 

You could write a loop (for i in range  )  to step through the list and collect the positions of words found perhaps 

Again - write a definition to get the word from the user and return it. - Write a definition to find the index numbers and return them too if you can 

Below - Only if you are struggling. 

Getting word from user - only if you are struggling


Finding indexes from the list

Below = Amended Main()

Ameded main - only if you are struggling