Issue in Part 2 Exercise: Story

Open
#69 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing-qa

Research direction

Start with the Part 2 Story exercise and the PythonEditorTest cases named test_part1b and test_part2b. Run both failing inputs to verify that each part is tested with its own appropriate termination input and that the repeated word in part 2 is handled as intended. Done means both tests pass without one part's input assumptions affecting the other.

Written by the indexing model from the issue text.

Description

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.

Dominant language
JavaScript
Stars
77
Forks
30
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rage/programming-26

All issues in rage/programming-26

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.