osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bussiness python


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)

#FV of annuity- continuous compounding
CF= 1000
r = 6/100/12
t = 12
import math
FV= CF * ((1 + (r/n)) ** (n*t))
print (FV)


#Annuity (FV)- solve for n
import math
FV= 19600
r = 5/100
p = 1000
n = math.log(1 + FV*r / p) / math.log(1+r)
print(n)


# annuity payments
PV= 100000 # how much
r = 5/100 # interest rate
n = 10 #how many years
p = r * (PV) / ((1 + r) ** n - 1)

print(p)

a = [1,2,3] # a list is just like an array, a list is mutable ( the objects can change)
b = a # b is pointing at the same list as a
print (type (a), id(a))
print (type(b), id(b))

the output is supposed to be
 5204.0401600000005
12336.416801016496
14.000708059400562
12350.45749654566