For the exercise Story in part 2 it has two parts namely part 1 and part 2 and only 1 code runner provided for both parts.
When testing code for part 1
story = ""
while True:
word = input("Please type in a word: ")
if word == "end":
break
story += word + " "
print(story)
'hello world' != ''
- hello world
+
: With the input
hello
world world
your program should print out:
hello world
your program printed out:
The testcase does not have the word end so the program actually never halts.
When testing code for part 2
story = ""
while True:
word = input("Please type in a word: ")
if word == "end" or word in story:
break
story += word + " "
print(story)
'Once upon a time there was a girl' != 'Once upon a time there was'
- Once upon a time there was a girl
? -------
+ Once upon a time there was
: With the input
Once
upon
a
time
there
was
a
girl
end
your program should print out:
Once upon a time there was a girl
your program printed out:
Once upon a time there was
The testcase is flawed because the input has the word a twice so the program should break out of the loop here Once upon a time there was.
For the exercise
Storyin part 2 it has two parts namely part 1 and part 2 and only 1 code runner provided for both parts.When testing code for part 1
The testcase does not have the word
endso the program actually never halts.When testing code for part 2
The testcase is flawed because the input has the word
atwice so the program should break out of the loop hereOnce upon a time there was.