{"id":"code-hs-python-while-trace-rows","audience":"high-school","category":"coding","track":"coding","technique":"format","title":"Trace a while loop one pass per line","free":false,"task":"You're studying for a quiz on while loops. Ask for a trace of the program in exactly 3 numbered lines, one per pass, each like 'After pass 1: n = 10, count = 1', then one unnumbered line 'Prints: <what it prints>'. No code blocks and no explanation, under 50 words.","materialLabel":"The practice program (attached to your prompt automatically)","material":"# Quiz review - Unit 5: while loops (Mr. Kaplan)\n\nn = 20\ncount = 0\nwhile n > 3:\n    n = n // 2\n    count = count + 1\nprint(n, count)\n\n# Reminders from class:\n#  - // is \"floor division\": 7 // 2 is 3, not 3.5\n#  - the condition is checked BEFORE each pass\n#  - a \"pass\" = one time through the indented block\n#\n# My attempt:\n#   pass 1: n = 10, count = 1\n#   pass 2: n = 5,  count = 2\n#   pass 3: n = 2.5 ???  then I got confused\n#\n# The quiz will have 2 tracing questions like this one.\n# We can't use a computer during the quiz, so I need to be able to\n# do it by hand.","rules":[{"type":"numberedItems","count":3},{"type":"codeBlocks","count":0},{"type":"maxProseWords","max":50}],"mistakes":[{"title":"Getting an explanation","why":"Asked to explain, the AI writes paragraphs about while loops instead of a trace you can check against yours.","fix":"Say: \"Exactly 3 numbered lines, one per pass, no explanation.\"","checks":["numberedItems","maxProseWords","r2"]},{"title":"No line shape","why":"Without an example, each line looks different and is hard to compare.","fix":"Show it: \"After pass 1: n = 10, count = 1\".","checks":["r0"]},{"title":"No final answer line","why":"The AI may not say clearly what gets printed.","fix":"Add: \"Then one line: Prints: <output>.\"","checks":["r1"]},{"title":"Code you don't need","why":"The AI may rewrite the program with print statements inside.","fix":"Add: \"No code.\"","checks":["codeBlocks"]}],"promptHints":[{"label":"Shows the line shape","patterns":["after pass","n = 10","like ['\"]"]},{"label":"Sets the number of lines","patterns":["\\b(3|three)\\b.{0,15}(line|pass)","one per pass"]},{"label":"Asks for the output line","patterns":["prints"]},{"label":"Rules out explanation","patterns":["no explanation","nothing else","no code"]}],"hint":"A trace you can check against your own needs the same shape as yours. Show the AI one line and ask for the final output in a fixed label.","rubricLabels":["The 3 numbered lines are After pass 1: n = 10, count = 1 / After pass 2: n = 5, count = 2 / After pass 3: n = 2, count = 3, in that form","The last line is exactly 'Prints: 2 3'","There is no explanation or other text besides the 3 numbered lines and the Prints line"]}