Problem 110710 · medium · Phase 01 Prerequisites & Setup

Savings Account Growth

functions · arithmetic · exponent · percentages · rounding

A savings account earns interest once a year, and the interest itself earns interest in later years. Write final_balance(principal, rate_percent, years) returning the balance after years full years, rounded to 2 decimal places.

For example, at 5% per year, 1000 becomes 1050 after one year and 1102.5 after two.

Examples

Input:  principal = 1000, rate_percent = 5, years = 2
Output: 1102.5
Input:  principal = 250, rate_percent = 0, years = 10
Output: 250.0

Constraints

  • 0 <= principal <= 10**9, 0 <= rate_percent <= 100, 0 <= years <= 100

Goals

  • Turn a percentage into a growth multiplier
  • Use the ** operator for repeated yearly growth
  • Round money to two decimals
Starting Python…