It appears I'm taking the same class as "brawdhampshire".
We don't know ".join" yet.
"brawdhampshire" I believe they are asking us to loop through the string and parse out each word.
Since we don't know ".join" wink, wink. My thought is we need to go through the string and find instances of the space (" "). The spaces will become our markers and we need to grab word between the spaces.
Below is my overly verbose code for purpose of explaining:
We don't know ".join" yet.
"brawdhampshire" I believe they are asking us to loop through the string and parse out each word.
Since we don't know ".join" wink, wink. My thought is we need to go through the string and find instances of the space (" "). The spaces will become our markers and we need to grab word between the spaces.
Below is my overly verbose code for purpose of explaining:
#start program here quote = "they stumble who run fast" start_of_word = 0 space_index = quote.find(" ") while space_index != -1: # code to print word (index slice start:space_index) print("First line of the while, the space_index = ", space_index) print("Lets get the word between index ",start_of_word, "and" ,space_index ) print("Here is the word :" , quote[start_of_word:space_index]) print ("\n") start_of_word = space_index +1 print("Start now = :", start_of_word) space_index = quote.find(" ", start_of_word) print("Last line of while, space index now = ", space_index) start_of_word = space_index +1 print("Start now = :", start_of_word) space_index = quote.find(" ", start_of_word) print("Last line of while, space index now = ", space_index)This will output:
Output:First line of the while, the space_index = 4
Lets get the word between index 0 and 4
Here is the word : they
Start now = : 5
Last line of while, space index now = 12
First line of the while, the space_index = 12
Lets get the word between index 5 and 12
Here is the word : stumble
Start now = : 13
Last line of while, space index now = 16
First line of the while, the space_index = 16
Lets get the word between index 13 and 16
Here is the word : who
Start now = : 17
Last line of while, space index now = 20
First line of the while, the space_index = 20
Lets get the word between index 17 and 20
Here is the word : run
Start now = : 21
Last line of while, space index now = -1