{"id":"code-work-js-python-take-home-function","audience":"job-seekers","category":"coding","track":"coding","technique":"constraints","title":"Finish a practice take-home function without breaking the rules","free":false,"task":"Finish the practice take-home function so it returns the IDs of orders placed at or after cutoff_hour. Keep the name and arguments exactly as given, and don't add any imports (the grader blocks them), so read the hour straight from the placed_at string. Return the IDs sorted from lowest to highest, and an empty list (not None) when orders is empty. No prints. One code block with only the function, at most 8 lines, then under 25 words outside the code.","materialLabel":"The starter code from the practice packet (attached to your prompt automatically)","material":"PRACTICE TAKE-HOME - Python, question 2 (from a prep site)\n\ndef late_orders(orders, cutoff_hour):\n    \"\"\"Return the IDs of orders placed at or after cutoff_hour.\"\"\"\n    pass\n\nSample input:\norders = [\n    {\"id\": 1042, \"placed_at\": \"2026-11-02 17:45\"},\n    {\"id\": 1007, \"placed_at\": \"2026-11-02 09:10\"},\n    {\"id\": 1019, \"placed_at\": \"2026-11-02 18:00\"},\n    {\"id\": 1003, \"placed_at\": \"2026-11-02 21:30\"},\n]\ncutoff_hour = 18\n\nExpected output for the sample: [1003, 1019]\n\nNotes from the prep site:\n- Hidden tests include an empty list of orders.\n- Times are always 24-hour and zero-padded.\n- Submissions are timed, so keep it short.\n- Readable code scores higher than clever code.","rules":[{"type":"codeBlocks","count":1},{"type":"maxCodeLines","max":8},{"type":"maxProseWords","max":25}],"mistakes":[{"title":"Not mentioning the import ban","why":"The AI imports datetime, which this grader blocks.","fix":"Add: \"No imports; read the hour from the string.\"","checks":["r0","r1"]},{"title":"Not giving the edge rules","why":"The AI uses > instead of >=, or returns the list unsorted.","fix":"Add: \"At or after the hour, sorted lowest to highest.\"","checks":["r1","r2"]},{"title":"Forgetting empty input","why":"The AI returns None or prints the result for empty input.","fix":"Add: \"Return [] for an empty list, no prints.\"","checks":["r2"]},{"title":"Getting a menu of options","why":"The AI likes to offer two or three versions of the function, so you're left to pick and test them yourself.","fix":"Add: \"Give one function only, in one code block, no alternatives.\"","checks":["codeBlocks","maxCodeLines"]},{"title":"Getting a tutorial","why":"By default the AI explains every part of the code at length, which you then have to scroll past.","fix":"Add: \"After the code, one line under 12 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Keeps the signature","patterns":["keep (the )?(name|signature)","unchanged","same (name|arguments)"]},{"label":"Bans imports","patterns":["no imports?","don'?t import","without (datetime|imports)"]},{"label":"Sets the edge rules","patterns":["at or after",">=","sorted"]},{"label":"Handles empty input","patterns":["empty","\\[\\]","not none"]},{"label":"Caps the code length","patterns":["\\d+\\s*lines","at most","under \\d+","short"]}],"hint":"Hidden tests and a blocked import are the traps. Tell the AI both, plus the exact order you want the IDs in.","rubricLabels":["Keeps def late_orders(orders, cutoff_hour): unchanged and has no import lines","Reads the hour from the placed_at string without libraries (for example int(o[\"placed_at\"][11:13]) or split) and keeps orders with hour >= cutoff_hour, so 18:00 counts","Returns the IDs sorted from lowest to highest (sorted(...)), returns [] for an empty orders list, and prints nothing"]}