Skip to content

Issue in Part 2 Exercise: Story #69

Description

@Aadithya369

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions