Summary
Two small usability gaps around the operation prompt, both reachable with ordinary input:
- The input is barely normalized.
.upper() is applied to the operation but nothing is stripped, so a leading or trailing space lands in the else. The symbols +, -, *, / and any abbreviation are likewise unrecognized. Neither number prompt is normalized at all.
- The rejection message does not repeat the options.
"That wasn't an option." gives the user no indication of what the options were, and — because the program exits immediately afterward — no chance to try again without re-running it.
Evidence
Verified this cycle under Python 2.7.18:
$ printf '6\n3\nbanana\n\n' | timeout 10 python calculator.py
What is the first number? What is the second number? Add, Subract, Multiply or Divide? That wasn't an option.
Any key to exit.
Line 3 applies .upper() and nothing else:
whatToDo = (raw_input("Add, Subract, Multiply or Divide? ")).upper()
Suggested fix
.strip() is added alongside the existing .upper(), and the rejection message is extended to name the four accepted keywords. Both are small and confined to existing lines.
Accepting the +, -, *, / symbols would widen what the program's interface accepts and is deliberately not proposed here — that belongs with the keyword decision tracked separately.
This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson
Summary
Two small usability gaps around the operation prompt, both reachable with ordinary input:
.upper()is applied to the operation but nothing is stripped, so a leading or trailing space lands in theelse. The symbols+,-,*,/and any abbreviation are likewise unrecognized. Neither number prompt is normalized at all."That wasn't an option."gives the user no indication of what the options were, and — because the program exits immediately afterward — no chance to try again without re-running it.Evidence
Verified this cycle under Python 2.7.18:
Line 3 applies
.upper()and nothing else:Suggested fix
.strip()is added alongside the existing.upper(), and the rejection message is extended to name the four accepted keywords. Both are small and confined to existing lines.Accepting the
+,-,*,/symbols would widen what the program's interface accepts and is deliberately not proposed here — that belongs with the keyword decision tracked separately.This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson