<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Donna Belle Ibarra wrote:
<blockquote
 cite="mid:fbcbd4f40901201004j5ba7654fha68628b2fe8faa34@mail.gmail.com"
 type="cite">Hi! I need help with program exericse #6 entitled
"Futval.py" which is a program that computes the value of an investment
carried 10 years into the future.<br>
  <br>
This is the coding I have.. yet it does not seem to spit out the
correct numbers (Am I using an incorrect equation?)<br>
</blockquote>
<br>
Take a look at
<a class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/Time_value_of_money#Present_value_of_a_future_sum">http://en.wikipedia.org/wiki/Time_value_of_money#Present_value_of_a_future_sum</a>
for the various formulas. I am not sure which applies in your case.<br>
<br>
<blockquote
 cite="mid:fbcbd4f40901201004j5ba7654fha68628b2fe8faa34@mail.gmail.com"
 type="cite"><br>
  <b>def main():<br>
&nbsp;&nbsp;&nbsp; print "This program calculates the future value"<br>
&nbsp;&nbsp;&nbsp; print "of a 10-year investment."<br>
  <br>
&nbsp;&nbsp;&nbsp; principal = input("Enter the amount invested each year: ")<br>
&nbsp;&nbsp;&nbsp; apr = input("Enter the annual interest rate: ")<br>
&nbsp;&nbsp;&nbsp; years = input("Enter the number of years: ")<br>
  <br>
&nbsp;&nbsp;&nbsp; for i in range (1, years + 1):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; principal = principal * (1 + apr)**i<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "The value in", i, " years is:", principal<br>
  <br>
main()</b><br>
  <br>
The output is suppose to appear like this:<br>
  <br>
This program calculates the future value of a 10-year investment.<br>
Enter the amount invested each year: 100.00<br>
Enter the annual interst rate: 0.05<br>
Enter the number of years: 10<br>
The value in 1 years is 105.0<br>
The value in 2 years is 215.25<br>
The value in 3 years is 331.0125<br>
The value in 4 years is 452.563125<br>
  <br>
And so on..<br>
  <br>
^Please help me!!!<br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Tutor maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
  </pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
Bob Gailer<br>
Chapel Hill NC<br>
919-636-4239</div>
</body>
</html>