A shipping program calculates a charge of 3 US dollars per kilogram for packages whose mass is at least 5 kilograms:
masses = [2, 5, 8, 11] charges = [3 * mass for mass in masses if mass >= 5]
Complete the trace table. Enter yes or no for whether each source item is kept. For its output contribution, enter an exact integer charge in US dollars or the word skipped when it contributes no element.
Unlock full course notes by signing up
Count and total selected ticket prices
A ticket service stores original ticket prices in US dollars. It selects prices of at least 12 dollars and reduces each selected price by 2 dollars:
Find the number of elements in offer_prices and the total of its prices in US dollars. Enter both answers as exact integers.
Locate outputs from a range
A technician generates calibration lengths in centimetres and converts them to millimetres using this Python 3 list comprehension.
Complete the table with the exact integer stored at each zero-based index. Every entry in lengths_mm represents a length in millimetres.
Separate filtering from conditional replacement
A calibration program processes signed readings measured in millivolts. Examine the conditional output expression and trailing filter in this Python code. Select every true statement about its execution.
Track comprehension variables across assignments
A scheduler builds new lists of integer priority scores using the following Python 3 code. Determine the requested values after all four statements have executed.
Report these three quantities as exact integers:
Outer priority: the final value of priority.