weekly_pay(hours, rate) where hours is a list of 7 daily work-hours. Regular time is the first 40 hours of the week; everything beyond pays 1.5×. Compute total pay — tracking the crossover mid-day correctly (a week of 5×9 hours crosses 40 during day 5).weekly_pay([9, 9, 9, 9, 9, 0, 0], 100)
4750.0
40 regular hours (4000) + 5 OT hours at 150 (750).
total_hours = sum(hours); OT = max(0, total - 40).
Pay = regular×rate + ot×rate×1.5.