Jan-26-2017, 09:04 PM
(This post was last modified: Jan-26-2017, 09:04 PM by BurnedChipotle.)
Hello I'm learning Python at school and have been set a task,
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.
For example, in the sentence
ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR
COUNTRY
The word ‘COUNTRY’ occurs in the 5th and 17th positions.
Analyse the requirements for this system and design, develop, test and evaluate a program to locate
and return the position(s) of the word you have selected in a particular sentence or return an error
message if the word is not in the sentence.
however my teacher has been off for the past 1-2 weeks due to a bad back and therefore I have had multiple supply teachers. I have written my code and it is working but now I have to do a write up explaining what my the variables are in my code and what they do, can somebody explain to me why am I using these certain variables or give me advice on what to write? Thank you
This is a screenshot of my code so far
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.
For example, in the sentence
ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR
COUNTRY
The word ‘COUNTRY’ occurs in the 5th and 17th positions.
Analyse the requirements for this system and design, develop, test and evaluate a program to locate
and return the position(s) of the word you have selected in a particular sentence or return an error
message if the word is not in the sentence.
however my teacher has been off for the past 1-2 weeks due to a bad back and therefore I have had multiple supply teachers. I have written my code and it is working but now I have to do a write up explaining what my the variables are in my code and what they do, can somebody explain to me why am I using these certain variables or give me advice on what to write? Thank you
This is a screenshot of my code so far