# File: Futurevalue.py # A simple program illustrating the future value of a savings account in 10 years def main(): p = eval(input ("Enter the initial principal amount in the savings account: ")) apr = eval(input ("Enter the annual interest rate: " )) for i in range(10): p = p*(1 + apr) print("The value in 10 years is:", p) main()
how do i rewrite this code to give me 10 outputs
how do i rewrite this code to give me 10 outputs
|
Mar-29-2018, 04:24 AM
your print statement is outside the loop.
Add 4 spaces before the print, thus making it part of the loop and you will see 10 outputs
Mar-29-2018, 11:29 AM
(This post was last modified: Mar-29-2018, 11:34 AM by BlackPimpernel.)
|
|
Users browsing this thread: 1 Guest(s)