Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Answer needs to be in Python. Your task is to, one last time, modify the code above so that it is more explicit and understandable.
Answer needs to be in Python.
Your task is to, one last time, modify the code above so that it is more explicit and understandable. There is one file used in this task - . You will be making changes to this file. Start your work by opening the file in your Visual Studio Code. Find the line in the . To complete assign the following constants with the values as indicated. - First, define 2 constants for the initial principal that is deposited to the account and the number of years it will be kept there. Name the constants INITIAL_PRINCIPAL and YEARS respectively. Assign them with the values of 10000.0 and 5 . - Define 3 constants for the interest rates associated with each account with the following names: ACCOUNT_RATE_1, ACCOUNT_RATE_2, and ACCOUNT_RATE_3. Assign them with the following values: 0.027,0.0268, and 0.0266. - Define 3 constants for the yearly compounding frequency with the following names: ACCOUNT_CMP_FREQ_1, ACCOUNT_CMP_FREQ_2, and ACCOUNT_CMP_FREQ_3. Assign them with the following values: 1, 12, and 365 . In TODO 2, you will implement the amount_after_n_years function with the init_principal, acc_rate, acc_cmp_freq, and years parameters. The function returns the amount that is going to be on the account after the specified number of years based on the provided parameters. You will be using the following formula: A=P(1+nr)nt - A : final amount - P: initial principal balance - r :interest rate - n : number of times interest applied per time period ( acc_cmp_freq) - t : number of time period elapsed For more details, please, refer to this tutorial. In TODO 3 , you will define - amount_3 variables ( 3 altogether) and assign each with the value returned by the amount_after_n_years. For each variable, the amount_after_n_years function call needs to be provided with the matching arguments from constants defined in TODO 1. For example, the correct assignment to the amount_1 variable looks like this: \[ \begin{array}{l} \text { amount_1 = amount_after_n_years (INITIAL_PRINCIPAL, ACCOUNT_RATE_1, } \\ \text { ACCOUNT_CMP_FREQ_1, YEARS) } \end{array} \] Finally, in TODO 4 , replace the existing print statements with the more informative ones that are currently commented out, i.e. marked with the \# prefix. You are required to go about this by commenting out the original two print statements by adding \# at the beginning.. Then, uncomment the 5 lines that are originally commented out by removing "\#" at the beginning. Note that you cannot just delete the two original print statements - that would result in you not obtaining the full score for this activityStep 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