Question: Write an improved version of the future vale program ..... # futval.py # A program to compute the value of an investment # carried 10
Write an improved version of the future vale program .....
# futval.py # A program to compute the value of an investment # carried 10 years into the future def main(): print("This program calculates the future value") print("of a 10-year investment.") principal = eval(input("Enter the initial principal: ")) apr = eval(input("Enter the annual interest rate: ")) for i in range(10): principal = principal * (1 + apr) print("The value in 10 years is:", principal) main() Your program will prompt the user for the amount of the investment, the annualized intrest rate, and the number of years of the investment. The program will then output a nicely formatted table that tracks the value of the investment year by year. Your output might look something like this .
Year Value
---------------------------
0 $2000.00
1 $2200.00
2 $2420.20
3 $2662.00
4 $2928.20
5 $3221.02
6 $3542.12
7 $3897.43
***Year and Value SHOULD have some space between them and so should the numbers and the $ amount but Chegg study changed the space between them.***
Program should be similar or based off of this program (or use this program to help you figure out how to change the orginal program ^)
# File Name: chaos.py # A simple program illustrating chaotic behavior. #definition of main function def main():
# prints the message to user print("This program illustrates a chaotic function") # reads a value between 0 and 1 from user and assigns it to variable x x = eval(input("Enter a number between 0 and 1: "))
#reads a value between 0 and 1 from user and assigns it to variable y y = eval(input("Enter a number between 0 and 1: "))
# prints x and y value print ("index ",x, " ",y)
#This "loop" tells Python to do the same thing over and over again for i in range(10): x = 3.9 * x * (1 - x) y = 3.9 * y * (1 - y)
# prints x and y value print(i+1, " ",x, " ",y)
# invoke or call function main main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
