Drill

ProblemsPython › scheduling

How many breaks does the shift need

easyschedulingPython

Labour law requires a 30-minute rest after every four hours on the floor. Count the mandatory breaks a shift of lengthMinutes earns.

break_count(length_minutes: int) → int

Solve it in the editor →

Where you start

def break_count(length_minutes: int) -> int:
    

Worked examples

CallResult
break_count(120)0
break_count(240)1
break_count(241)1
break_count(480)2

Hint

Integer-divide the minutes by 240.

Reference solution in Python
def break_count(length_minutes: int) -> int:
    if length_minutes < 240:
        return 0
    return length_minutes // 240

The same problem in another language

More scheduling problems in Python