Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def months_to_reach_target(principal, interest_rate_per_annum, target):
- interest_rate_per_month = (interest_rate_per_annum / 100) / 12
- num_months = 0
- while principal < target
- # I think we can just reassign principal as python references are passed by assignment
- principal += principal * interest_rate_per_month
- num_month += 1
- return num_months
- print(months_to_reach_target(100, 10, 200))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement