The math module provides ceil, which rounds a number up to a whole integer. A partial boat still needs a reservation.
An average of 2.01 hours exceeds a two-hour booking. Compare how two rounding functions treat that fraction.
from math import ceil, floor
hours = 2.01
print(floor(hours), ceil(hours)) # 2 3
print(ceil(2.0)) # 2Rounding up preserves an exact whole number. For the boat problem, first find the fractional number of loads.
Given a nonnegative number of people and positive capacity per boat, return the whole number of boats required. Use the imported ceil function.
boats_needed(11, 5) # 3