bussiness python
timetowalk
timetowalk11 at gmail.com
Tue Sep 5 20:40:49 EDT 2017
On Tuesday, September 5, 2017 at 8:28:00 PM UTC-4, MRAB wrote:
> 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
For line #3, r = 2/100 is zero.
For line #5, 1/r will cause an exception
More information about the Python-list
mailing list