Simple interest on a loan is calculated by simply taking the initial amount (the principal, p) and multiplying it by a rate of interest (r) and the number of time periods (n). 

Compound interest is calculated by adding the interest after each time period to the amount owed, then calculating the next interest payment based on the principal PLUS the interest from all previous periods.

Given a principal *p*, interest rate *r*, and a number of periods *n*, return an array [total owed under simple interest, total owed under compound interest]. 

```
EXAMPLES:

interest(100,0.1,1) = [110,110]
interest(100,0.1,2) = [120,121]
interest(100,0.1,10) = [200,259]
```
 
Round all answers to the nearest integer. Principal will always be an integer between 0 and 9999; interest rate will be a decimal between 0 and 1; number of time periods will be an integer between 0 and 49. 
 
---

More on [Simple interest, compound interest and continuous interest](https://betterexplained.com/articles/a-visual-guide-to-simple-compound-and-continuous-interest-rates/)

Difficulty: introductory

Starter code:

def interest(p,r,n):
	

Solutions:
def interest(principal, interest, periods):
    return [round(principal * (1 + interest * periods)),
            round(principal * (1 + interest) ** periods)]

def interest(p, r, n):
    return [round(p * i) for i in ((1 + (r * n)), (1 + r)**n)]

def interest(money, rate, periods):
    simple = money * (1 + rate * periods)
    compound = money * (1 + rate) ** periods
    return [round(simple), round(compound)]

def interest(p,r,n):
    return [round(p * (1 + (r * n))), round(p * (1 + r) ** n)]

def interest(p,r,n):
    return [round(p+p*r*n), round(p*((1+r)**n))]

def interest(p,r,t):
    return [round(p + p*r*t), round(p*(1 + r)**t)] 

def interest(p, r, n):
    a = round(p + n*p*r)
    b = round(p*(1+r)**n)
    return [a, b]

def interest(p,r,n):
    return [p+round(p*r*n),round(p*(1+r)**n)]

def interest(p,r,n):
    simple = p + p * r * n
    while n > 0:
        n -= 1
        p += p * r
    return [round(simple), round(p)]

def interest(p,r,n):
    return [round(p+p*r*n), compound(p,r,n)]

def compound(p,r,n):
    return round(p) if n<1 else compound(p+p*r,r,n-1)