{"assignment":{"_schema_version":2,"course_id":37,"date_created":"2022-06-28T19:00:00+00:00","date_modified":"2026-03-12T20:32:08.013561+00:00","extra_instructor_files":"","extra_starting_files":"","forked_id":null,"forked_version":null,"hidden":false,"id":1080,"instructions":"{\n  \"settings\": {\n    \"readingId\": \"bakery_for_composition_read\"\n  },\n  \"questions\": {\n    \"FlowBetweenLoopFunctions\": {\n      \"type\": \"multiple_answers_question\",\n      \"points\": 3,\n      \"body\": \"Given the program below,\\n```python\\nmessages = [\\\"go\\\", \\\"fly\\\", \\\"a\\\", \\\"kite\\\"]\\n\\ndef join_strings(messages: list[str]) -> str:\\n    result = \\\"\\\"\\n    for message in messages:\\n        result = result + \\\", \\\" + message\\n    return result\\n\\ndef map_title_case(messages: list[str]) -> list[str]:\\n    result = []\\n    for message in messages:\\n        result.append(message.title())\\n    return result\\n\\n# ____ <-- What goes here?\\n\\nprint(messages)\\n```\\n\\nWhich of the following lines of code should be put in the blank to make the strings Title Cased and joined together with\\ncommas?\",\n      \"answers\": [\n        \"<div class=\\\"codehilite\\\" style=\\\"background: #f8f8f8;\\\"><pre style=\\\"line-height: 125%;\\\"><span></span>map_title_case(messages)\\njoin_strings(messages)\\n</pre></div>\",\n        \"<div class=\\\"codehilite\\\" style=\\\"background: #f8f8f8;\\\"><pre style=\\\"line-height: 125%;\\\"><span></span>messages <span style=\\\"color: #666666;\\\">=</span> join_strings(map_title_case(messages))\\n</pre></div>\",\n        \"<div class=\\\"codehilite\\\" style=\\\"background: #f8f8f8;\\\"><pre style=\\\"line-height: 125%;\\\"><span></span>map_title_case()\\njoin_strings()\\n</pre></div>\",\n        \"<div class=\\\"codehilite\\\" style=\\\"background: #f8f8f8;\\\"><pre style=\\\"line-height: 125%;\\\"><span></span>join_strings(map_title_case(messages))\\n</pre></div>\",\n        \"<div class=\\\"codehilite\\\" style=\\\"background: #f8f8f8;\\\"><pre style=\\\"line-height: 125%;\\\"><span></span><span style=\\\"color: #008000; font-weight: bold;\\\">print</span>(map_title_case(messages))\\n<span style=\\\"color: #008000; font-weight: bold;\\\">print</span>(join_strings(messages))\\n</pre></div>\",\n        \"<div class=\\\"codehilite\\\" style=\\\"background: #f8f8f8;\\\"><pre style=\\\"line-height: 125%;\\\"><span></span>messages <span style=\\\"color: #666666;\\\">=</span> map_title_case(messages)\\nmessages <span style=\\\"color: #666666;\\\">=</span> join_strings(messages)\\n</pre></div>\",\n        \"None are necessary, because the variables share the same name.\"\n      ]\n    },\n    \"LoopCompositionAdvantages\": {\n      \"type\": \"multiple_answers_question\",\n      \"points\": 1,\n      \"body\": \"What are advantages and reasons to compose loops?\",\n      \"answers\": [\n        \"Breaking up complex loops into separate functions makes each function easier to debug.\",\n        \"Smaller loop functions are easier to write because each piece is simpler.\",\n        \"Loop composition makes loops faster because they are broken up.\",\n        \"Loop composition takes less time because variables can be shared between the functions.\",\n        \"We don't need loops at all if we are composing functions.\"\n      ]\n    },\n    \"AvoidUnnecessaryLoopInLoopComposition\": {\n      \"type\": \"multiple_choice_question\",\n      \"points\": 1,\n      \"body\": \"Given the following code to calculate the average of a list of numbers, identify the correct statement.\\n```python\\ndef average(numbers: list[int]) -> float:\\n    if not numbers:\\n        return None\\n    for number in numbers:\\n        return sum(numbers) / count(numbers)\\n```\",\n      \"answers\": [\n        \"This function does not need a for loop.\",\n        \"This code is perfectly fine.\",\n        \"The arguments to sum and count should be number, not numbers.\",\n        \"You shouldn't need to sum or count in order to calculate the average of a list of numbers.\",\n        \"You cannot check whether a list is empty with the condition in the if statement.\",\n        \"The result of the count function needs to be passed as an argument to the sum function.\"\n      ]\n    },\n    \"ReorderLoopComposition\": {\n      \"type\": \"multiple_answers_question\",\n      \"points\": 2,\n      \"body\": \"Consider the following functions' names, parameters, and return values.\\n```python\\ndef convert_grade(grade: int) -> str:\\n    pass\\n\\ndef map_convert_grades(grades: list[int]) -> list[str]:\\n    pass\\n\\ndef remove_failed_grades(text_grades: list[str]) -> list[str]:\\n    pass\\n\\ndef get_passing_text_grades(grades: list[int]) -> list[str]:\\n    pass\\n```\\n\\nWhich of the following statements would be good compositions?\",\n      \"answers\": [\n        \"The <code>map_convert_grades</code> function will directly call <code>convert_grade</code>\",\n        \"The <code>get_passing_text_grades</code> function will directly call <code>remove_failed_grades</code>\",\n        \"The <code>get_passing_text_grades</code> function will directly call <code>map_convert_grades</code>\",\n        \"The <code>get_passing_text_grades</code> function will directly call <code>convert_grade</code>\",\n        \"The <code>remove_failed_grades</code> function will directly call <code>convert_grade</code>\",\n        \"The <code>map_convert_grades</code> function will directly call <code>remove_failed_grades</code>\",\n        \"The <code>map_convert_grades</code> function will directly call <code>get_passing_text_grades</code>\",\n        \"The <code>convert_grade</code> function will directly call <code>get_passing_text_grades</code>\"\n      ]\n    }\n  }\n}","ip_ranges":"","name":"6B2) Loop Composition","on_change":"","on_eval":"","on_run":"","owner_id":1,"owner_id__email":"acbart@udel.edu","points":1,"public":true,"reviewed":false,"sample_submissions":[],"settings":"","starting_code":"","subordinate":false,"tags":[],"type":"quiz","url":"bakery_for_composition_quiz","version":4},"ip":"216.73.216.157","submission":{"_schema_version":3,"assignment_id":1080,"assignment_version":4,"attempts":0,"code":"","correct":false,"course_id":37,"date_created":"2026-05-20T12:51:55.941877+00:00","date_due":"","date_graded":"","date_locked":"","date_modified":"2026-05-20T12:51:55.941877+00:00","date_started":"","date_submitted":"","endpoint":"","extra_files":"","feedback":"","grading_status":"NotReady","id":2036887,"score":0.0,"submission_status":"Started","time_limit":"","url":"submission_url-d421c845-6e97-483d-8ded-b9467ad29841","user_id":2044663,"user_id__email":"","version":0},"success":true}
