The day you exceed the goal
Write code · Medium · §1.2 Sizing up
You have start followers today, and you gain per_day followers each day. Complete the function solution, which returns the first day on which you have more than goal followers.
Today is day 0. If you already have more than goal followers today, return 0.
Function
solution(start, per_day, goal)
Constraints
startandgoalare integers from 0 to 1,000,000,000,000.per_dayis an integer from 1 to 1,000,000.
Examples
| start | per_day | goal | result |
|---|---|---|---|
120 | 35 | 500 | 11 |
500 | 10 | 500 | 1 |
Starter code
def solution(start, per_day, goal):
answer = 0
return answerSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.