bussiness python

MRAB python at mrabarnett.plus.com
Tue Sep 5 20:27:46 EDT 2017


On 2017-09-05 22:21, jessicayates59 at gmail.com wrote:
> Here's a code that I have, i'm getting an error in line 5 and i'm not sure why,
> 
> 
> # future value of annuity
> p = 1000
> r = 2/100
> n = 5
> FV= p * ((1+r) ** n - 1/r)
> print(FV)
> 
[snip]

> the output is supposed to be
>   5204.0401600000005
[snip]

Your formula is wrong. The second closing parenthesis is in the wrong place.

That line should be:

FV = p * ((1 + r) ** n - 1) / r



More information about the Python-list mailing list