All problems
Ski Rental Break Even Days
Problem
Return the number of rental days after which buying is no more expensive than renting.
Each day of renting costs rent_cost and buying costs buy_cost once, so the break-even point is ceil(buy_cost / rent_cost). Return 0 when either cost is non-positive.
Hint
The deterministic break-even ignores the unknown number of future ski days.
Test cases
case 1
in: [100,10]
expected: 10
case 2
in: [100,30]
expected: 4
case 3
in: [7,7]
expected: 1
case 4
in: [0,5]
expected: 0
case 5
in: [50,0]
expected: 0
Starter codePython
def ski_rental_break_even(buy_cost, rent_cost):
# Your code here
pass5 test cases · run your code against them in the editor