A dispatch program orders jobs by urgency using the Python code below. Each pair contains a job label followed by its integer urgency level.
A key function returns the value that a sorting utility uses to order each item. Python’s sorted places smaller keys first, and jobs with equal keys retain their original input order.
jobs = [("A", 3), ("B", 5), ("C", 3), ("D", 4)] def dispatch_key(job): return -job[1] ordered_jobs = sorted(jobs, key=dispatch_key)
Complete the table with each job’s returned key and its position in ordered_jobs, counting the first position as 1. Enter exact integers in every blank.
Unlock full course notes by signing up
Return behavior for a later call
A game needs make_adjustment(delta) to return a reusable function that adds delta to a score supplied later. The final outer return statement is missing from this Python code:
Complete that statement by supplying only the function's identifier: return ________.
Analyze nested composition and call timing
A score-processing library constructs new functions using the Python code below. Select every true statement about the resulting functions and their evaluation.
Merge chunk summaries without changing behavior
An event-processing program computes an integer summary using a reduction, which combines successive values into one running result through a supplied callback.
The first slice contains the first three codes, and the second contains the last two. A developer proposes replacing the sequential computation with separately computed chunk summaries.
Find whole and naive. Then find the constant multiplier w such that w * left + right reproduces the sequential result for every possible choice of integer codes with these same chunk lengths. Enter all three answers as exact, unitless integers.