{"id":"code-hs-check-pseudocode-translation","audience":"high-school","category":"coding","track":"coding","technique":"verification","title":"Check your Python translation of AP CSP pseudocode","free":false,"task":"You translated an AP CSP pseudocode procedure into Python and want it checked, not rewritten. Ask for exactly 5 numbered lines, one per Python line in order, each '1. Match - pseudocode line 1' or '2. Mismatch - pseudocode line 2: what's different' with the difference under 15 words. No code blocks and no corrected code, under 90 words.","materialLabel":"The pseudocode and your Python (attached to your prompt automatically)","material":"AP CSP practice - translate this procedure into Python\n\nPseudocode (line numbers on the left):\n1  total <- 0\n2  FOR EACH n IN nums\n3  {\n4     IF (n MOD 2 = 0)\n5     {\n6        total <- total + n\n7     }\n8  }\n9  DISPLAY(total)\n\nMy Python (line numbers on the left):\n1  total = 0\n2  for n in range(len(nums)):\n3      if n % 2 == 0:\n4          total = total + n\n5  print(total)\n\nTest: nums = [3, 4, 7, 10]\nPseudocode by hand: 4 + 10 = 14\nMy Python prints: 2\n\nI think lines 3 and 4 are fine because they look the same as the\npseudocode. Mr. Lindqvist said \"check what n IS in each version.\"\nAP reference sheet: FOR EACH item IN aList - the variable item is\nassigned the value of each element of aList.","rules":[{"type":"numberedItems","count":5},{"type":"codeBlocks","count":0},{"type":"maxProseWords","max":90}],"mistakes":[{"title":"Getting a rewrite","why":"The AI's default is to hand you the fixed Python, so you don't learn where it went wrong.","fix":"Say: \"Check it, don't rewrite it. No corrected code.\"","checks":["r2","codeBlocks"]},{"title":"Vague verdicts","why":"Without labels, the AI says 'mostly right' and you can't tell which line.","fix":"Add: \"Label each line exactly Match or Mismatch.\"","checks":["r0"]},{"title":"No pointer to the pseudocode","why":"A verdict without the matching pseudocode line is hard to check.","fix":"Add: \"Name the pseudocode line each one matches.\"","checks":["r1","r2"]},{"title":"A long lesson","why":"The AI explains FOR EACH and range() at length.","fix":"Add: \"Exactly 5 numbered lines, one per Python line.\"","checks":["numberedItems","maxProseWords"]}],"promptHints":[{"label":"Asks for a check, not a rewrite","patterns":["don'?t (rewrite|fix|correct)","no (corrected|fixed) code","just check"]},{"label":"Gives exact labels","patterns":["mismatch","\\bmatch\\b"]},{"label":"Asks for one line each","patterns":["one per (python )?line","\\b(5|five)\\b.{0,15}line","each line"]},{"label":"Asks for the pseudocode line","patterns":["pseudocode line","which line"]},{"label":"Caps each difference","patterns":["\\d+\\s*words"]}],"hint":"Line-by-line labels show exactly where a translation drifts. Ask for one verdict per line with the matching pseudocode line, and no rewrite.","rubricLabels":["Marks Python line 2 as Mismatch and lines 1, 3, 4 and 5 as Match","The line 2 Mismatch says range(len(nums)) gives the indexes, not the values that FOR EACH gives","Each line follows the form 'N. Match - pseudocode line X' or 'N. Mismatch - pseudocode line X: ...', and no corrected Python is given"]}