{"id":"code-hs-python-dict-print-quiz","audience":"high-school","category":"coding","track":"coding","technique":"grounding","title":"Make a 'what does this print?' quiz on Python dictionaries","free":false,"task":"Make yourself a practice quiz from your class notes on dictionaries. Exactly 5 numbered questions, each written as 'What does this print? `...`' with a one-line snippet in backticks; then a line 'Answers' and 5 numbered answers that are only the printed output. Include one question on .get with a default and one that loops over a dict, using your teacher's correction about order. No code blocks, under 150 words.","materialLabel":"Your class notes (attached to your prompt automatically)","material":"Intro to Python - Unit 6: Dictionaries (Mr. Osei)\n\ndict = key: value pairs inside { }\n  pets = {\"cat\": 2, \"dog\": 1}\n  pets[\"cat\"]   -> 2\n  pets[\"fish\"]  -> KeyError!! (key isn't there)\n\n.get(key) -> value, or None if missing\n.get(key, default) -> value, or the default if missing\n  pets.get(\"fish\", 0) -> 0\n\nadd / change:  pets[\"bird\"] = 4\ndelete:        del pets[\"dog\"]\nlen(pets)      -> number of keys\n\nloop:\n  for k in pets:          # loops over KEYS\n      print(k)\n  for k, v in pets.items():   # keys AND values\n\n~~dicts have no order, keys come out random~~\nMr. Osei corrected this: since Python 3.7 dicts KEEP INSERTION ORDER.\n(he said the old line is from last year's slides)\n\n\"in\" checks keys, not values:\n  \"cat\" in pets  -> True\n  2 in pets      -> False\n\nQuiz Friday! Bring a pencil, no laptops.","rules":[{"type":"questionCount","count":5},{"type":"codeBlocks","count":0},{"type":"maxProseWords","max":150}],"mistakes":[{"title":"Missing the correction","why":"The crossed-out line is still in your notes, and the AI may write a question saying dict order is random.","fix":"Add: \"Use the correction: dicts keep insertion order.\"","checks":["r2"]},{"title":"Mixed question types","why":"The AI writes true/false, fill-in and essay questions you won't see on Friday.","fix":"Show it: \"Each question like: What does this print? `print(pets.get(\\\"fish\\\", 0))`\".","checks":["r0"]},{"title":"Skipping the tricky parts","why":"The AI may not test .get defaults, which is the part people miss.","fix":"Add: \"Include one question on .get with a default.\"","checks":["r1"]},{"title":"Answers mixed in or explained","why":"The AI puts answers under each question with explanations, or adds code blocks.","fix":"Add: \"Then a line 'Answers' and 5 numbered answers, output only. No code blocks.\"","checks":["questionCount","codeBlocks","maxProseWords"]}],"promptHints":[{"label":"Sets the number of questions","patterns":["\\b(5|five)\\b.{0,20}question"]},{"label":"Shows the question shape","patterns":["what does this print","backtick","one.line"]},{"label":"Asks for the tricky parts","patterns":["\\.get","default","loop"]},{"label":"Mentions the correction","patterns":["order","insertion","correction"]},{"label":"Separates the answers","patterns":["answers","answer key","at the end"]}],"hint":"A good practice quiz looks like the real one and tests what you'd get wrong. Show the question shape, name the tricky topics and point the AI at your teacher's correction.","rubricLabels":["Every question is written as 'What does this print?' followed by a one-line snippet in backticks on the same line","One question uses .get with a default value for a missing key, and its answer is that default","One question loops over a dict, and its answer lists the keys in the order they were inserted; after a line 'Answers', each of the 5 answers is only the printed output with no explanation"]}