Drill

ProblemsPython › machines

Finished units in a shift

mediummachinesPython

A production planner works out how much good product a shift turns out: run time at a rate, less scrap.

shift_output(per_hour: int, shift_minutes: int, break_minutes: int, scrap_percent: int) → int

Solve it in the editor →

Where you start

def shift_output(per_hour: int, shift_minutes: int, break_minutes: int, scrap_percent: int) -> int:
    

Worked examples

CallResult
shift_output(360, 480, 30, 10)2430
shift_output(60, 120, 0, 0)120
shift_output(360, 480, 480, 0)0
shift_output(60, 390, 30, 25)270

Hint

Do the truncation at each step: first production, then finished.

Reference solution in Python
def shift_output(per_hour: int, shift_minutes: int, break_minutes: int, scrap_percent: int) -> int:
    production = (shift_minutes - break_minutes) * per_hour // 60
    return production * (100 - scrap_percent) // 100

The same problem in another language

More machines problems in Python