Codington
0 of 6 problems solved • 0%

Exercise prompt

Quote a Print Job

A quote has two independent steps: convert pages to sheets, then charge for those sheets. Try each helper from the editor before running the checks.

Example

def ride_minutes(stops): return stops * 3 def arrival(start_minute, stops): return start_minute + ride_minutes(stops) print(arrival(10, 4)) # 22

Check the inner calculation first: four stops take twelve minutes. The outer function then adds the starting time.

Your task

Write sheet_count(pages, double_sided) and quote(pages, double_sided, price). Pages is nonnegative. One-sided printing uses one sheet per page, and double-sided printing needs a whole sheet for the last odd page. The quote is sheets times price.