A dispatch program runs the following Python code once for each parcel. The variable mass gives the parcel mass in kilograms; express and fragile contain Boolean values.
if mass <= 20: if express: if fragile: print("Padded express") else: print("Express") else: print("Standard") else: print("Oversize")
Count a condition evaluation whenever execution reaches an if and tests its condition. An else does not perform another test.
Parcel
Mass (kg)
express
fragile
Birch
24
True
Cedar
12
False
Maple
8
Pine
20
Across these four independent runs, find the total number of condition evaluations and the number of those evaluations that return true. Enter both counts as exact integers.
Unlock full course notes by signing up
Carry values through a nested path
A reading challenge calculates reward points with the following Python code. For books = 5 and returned_on_time = False, what is the final value of points? Answer in points, to the nearest whole point.
Which output claims follow?
A file-opening program uses the following Python code. Select every statement that correctly describes its output for the specified input conditions.
Both inputs store either True or False, and execution always reaches the end of this code.
The cost of moving an else
A festival checkout has two versions of its ticket-pricing code. Each version starts independently, and both inputs are either True or False.
Program A
Program B