promptdojo_

Conditionals and the truthiness traps — step 7 of 8

Cursor wrote if status is "done": and the branch seems to work in this snippet — CPython's small-string interning makes the literal "done" and the variable holding "done" the same object, so is returns True here, and recent Python versions even emit a SyntaxWarning to flag the pattern. The moment status comes from JSON, input(), the network, or anywhere else the string isn't a literal, this comparison silently fails — the string equals "done" but isn't the same object as the literal. Plus the SyntaxWarning is a strong signal you're using the wrong operator.

Fix line 3 so the script prints shipping it AND uses the semantically-correct operator for string comparison.

The break is on line 3 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.