May-18-2020, 01:52 AM
Can someone tell me what, if anything, I should be doing differently on this homework question?
I am given this (where the student continues to type below):
Thank you for any input!
Quote:Instructions
Program: print each word in a quote
start = 0
space_index = quote.find(" ")
while space_index != -1:
# code to print word (index slice start:space_index)
Output should look like below:
they
stumble
who
run
fast
I am given this (where the student continues to type below):
quote = # [ ] Print each word in the quote on a new line quote = "they stumble who run fast"I add onto it (with the initial 2 given lines shown above):
# [ ] Print each word in the quote on a new line quote = "they stumble who run fast" start = 0 space_index = quote.find(" ") while space_index != -1: print(quote[start:space_index]) start = space_index + 1 space_index = quote.find(" ", space_index + 1)My output is this:
they stumble who runSO, since there IS NOT a space (" ") after the word "fast" in the given statement, I don't know how else do render this correctly. Have I done all I can do correctly, but they just forgot to add a space (" ")?
Thank you for any input!