Check your understanding of the previous reading: the Todo List program.
This program has a lot of decomposition. Which of the following functions have a decomposition relationship?
Select every one that applies, then check.
make_todo_list builds each row with make_todo_toggle(todo.completed, target_id).toggle_complete starts with todo = lookup_todo_item(state.todos, target_id).remove_todo builds its own new_todos list with a loop and an if todo.id != target_id check; it never calls lookup_todo_item.edit_todo starts with editing = lookup_todo_item(state.todos, target_id).save_changes starts with todo = lookup_todo_item(state.todos, target_id).add_todo only builds and returns the "Create New Todo" page; there is no existing item to look up yet.The remove_todo function uses which loop pattern that we taught you previously?
Select one answer, then check.
remove_todo checks every item instead.remove_todo builds new_todos by keeping every item whose id != target_id, which is exactly Filter: keep the elements that satisfy a condition.remove_todo collects every item that does not match, into a new list.remove_todo keeps items unchanged and only decides whether to include them.Which of the following is the best description of the target_id variable in the make_todo_list function?
Select one answer, then check.
make_todo_list, target_id = Argument("target_id", todo.id): it's wrapped in an Argument, not a plain integer.todo.id (the item's unique ID), not its position in the list, and it's wrapped in an Argument, not a plain integer.todo.id is an int field on TodoItem, and the value here is wrapped in an Argument, not a string.target_id = Argument("target_id", todo.id) wraps the current loop iteration's todo.id, and is then passed to the row's buttons so clicking one sends that specific item's ID.for todo in todos, which never produces an index at all; the wrapped value is todo.id, the item's unique ID.The difficulty is a string in some places and an integer in others, even though it's the same conceptual thing every time (the difficulty of the todo item). Which of these statements about this is NOT true?
Select one answer, then check.
TodoItem.difficulty: int, filled with values like 1 from DIFFICULTY_RATINGS.difficulty = "⭐" * todo.difficulty builds exactly that star string.SelectBox call inside make_todo_list at all: SelectBox only appears in edit_todo and add_todo. And even there, its third argument is a plain digit string from DIFFICULTY_RATINGS ("1", "2", "3") or str(editing.difficulty), never a string of stars.save_changes(state, new_name: str, new_difficulty: int, ...) annotates it as an int, and it's stored straight into todo.difficulty.