The next step for this small project is mount it in window and make a desktop program for windows and carry out comparisons among different investment projects. And then... and then...
### PROGRAM TO CALCULATE THE NET PRESENT VALUE
### WITH CONSTANT AND VARIABLE INTEREST
#### DATA ####
t_in=raw_input("costant interest? y /n")
t = int(raw_input("Number of years?:"))
x = float(raw_input("initial investment?:"))
van = -x
#### CONSTANT INTEREST ####
if t_in == "y":
i = float(raw_input("interest(%):"))
for j in range(1, t + 1):
print "flujo caja ano", j
f = float(raw_input())
ret = f / ((1 + (i / 100)) ** j)
van += ret
#### VARIABLE INTEREST ####
if t_in =="n":
print "Interest is not constant"
prod = 1
for j in range(1, t + 1):
print "Cashflow year", j
cf = float(raw_input())
print "Interest year", j
i = float(raw_input(""))
prod *= (1+(i/100)) # Productory
van += cf/prod # Sumatory
##### RESULTS #####
print "Net present value is:", van
if van >= 0:
print "You can invest"
elif van < 0:
print "Do not invest"
elif van = 0
print "Use more indicators"
No hay comentarios:
Publicar un comentario