Question
After reading the file, extract the information about the years, principal, interest and all the balances for each year of accural of interest, stored in
After reading the file, extract the information about the years, principal, interest and all the balances for each year of accural of interest, stored in variables in your program for later use. Expect to convert those extracted bits of information into the right Python data types (whether they are a list of floatnumbers, single float or int values, etc.) Using the extracted information, you need to print out a nice table. Notice that the decimal numbers have two places of precision, monetary values have a dollar sign for U.S. Dollars, and the percentage rate is printed as a percentage value, not a basic decimal number. You will need to use Python string formatting to format the table nicely.
the file is a .txt file and the contents are below:
years 10 principal 42420 interest 0.042 42420 44201.64 46058.10888 47992.549452960004 50008.23652998432 52108.582464243664 54297.1429277419 56577.62293070706 58953.88309379676 61429.946183736225 64010.00392345315
Line 1 always has the format years
Line 2 always has the format principal
Line 3 always has the format interest
Line 4, and all remaining lines of the file will be just a decimal number, one per line
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started