r/learnpython•
Wegener

Trying to create a program to discount cash flows

I know I need to use a for loop, I'm just not sure how exactly to implement it.

periods=int(raw_input("Enter payment periods: "))
pmt=int(raw_input("Enter payment amount: "))
fv=int(raw_input("Enter terminal amount: "))
ir=float(raw_input("Enter interest rate (as a decimal): "))

list = [pmt for i in range(periods)]

list[-1]+=fv

So what I have is the list of cash flows from period 1 to period 10. What I need to do is apply the formula to discount the cash flows to each member of that list.

The formula being cf/(1+rate)^n

I'm a noob so I'm really not good at this..

Thanks.

Posted Jun 23, 2012, 11:40 PM UTC

23
Loading comments…