SlideShare una empresa de Scribd logo
1 de 5
Descargar para leer sin conexión
# TODO 1: Define the constants as instructed in the writeup and assign them
# the correct values.
INITIAL_PRINCIPAL = 10000.0
YEARS = 5
ACCOUNT_RATE_1 = 0.027
ACCOUNT_RATE_2 = 0.0268
ACCOUNT_RATE_3 = 0.0266
ACCOUNT_CMP_FREQ_1 = 1
ACCOUNT_CMP_FREQ_2 = 12
ACCOUNT_CMP_FREQ_3 = 365
# TODO 2: Implement the `amount_after_n_years` function.
def amount_after_n_years(init_principal, acc_rate, acc_cmp_freq, years):
n = acc_cmp_freq
r = acc_rate
t = years
A = init_principal * (1 + r/n)**(n*t)
return A
# TODO 3: Define the 3 `amount_*` variables and assign them the values as
# instructed in the writeup.
c1 = 10000 * (1 + 0.027) ** 5
c2 = 10000 * (1 + 0.0268 / 12) ** (5 * 12)
c3 = 10000 * (1 + 0.0266 / 365) ** (5 * 365)
def main():
print(c1, c2, c3)
print(max(c1, c2, c3))
amount_1 = amount_after_n_years(INITIAL_PRINCIPAL, ACCOUNT_RATE_1,
ACCOUNT_CMP_FREQ_1, YEARS)
amount_2 = amount_after_n_years(INITIAL_PRINCIPAL, ACCOUNT_RATE_2,
ACCOUNT_CMP_FREQ_2, YEARS)
amount_3 = amount_after_n_years(INITIAL_PRINCIPAL, ACCOUNT_RATE_3,
ACCOUNT_CMP_FREQ_3, YEARS)
if __name__ == "__main__":
# TODO 4: Follow the instructions in the writeup to comment out the two
# print statements and uncomment the remaining lines of the code
# block.
main()
# print(f"Account option 1 will hold ${amount_1:,.2f}.")
# print(f"Account option 2 will hold ${amount_2:,.2f}.")
# print(f"Account option 3 will hold ${amount_3:,.2f}.")
# print(f"The maximum amount that can be reached is "
# f"${max(amount_1, amount_2, amount_3):,.2f}.")
print("After {} years, the initial principal of {:.2f} in account 1 with an interest rate of {}
compounded {} times per year would grow to {:.2f}.".format(YEARS, INITIAL_PRINCIPAL,
ACCOUNT_RATE_1, ACCOUNT_CMP_FREQ_1, amount_1))
print("After {} years, the initial principal of {:.2f} in account 2 with an interest rate of {}
compounded {} times per year would grow to {:.2f}.".format(YEARS, INITIAL_PRINCIPAL,
ACCOUNT_RATE_2, ACCOUNT_CMP_FREQ_2, amount_2))
print("After {} years, the initial principal of {:.2f} in account 3 with an interest rate of {}
compounded {} times per year would grow to {:.2f}.".format(YEARS, INITIAL_PRINCIPAL,
ACCOUNT_RATE_3, ACCOUNT_CMP_FREQ_3, amount_3))
Submission log file:
[ERROR] 2023-02-25 GMT-0500 08:21:50.778: An unexpected error has occurred.
Traceback (most recent call last):
File "<string>", line 74, in run
File "<string>", line 31, in generate_submission_archive
File "<string>", line 51, in __list_files_for_submission
File "<string>", line 65, in __generate_task_specific_files
File "<string>", line 138, in task3
File "<string>", line 24, in silent_import
File "<string>", line 22, in silent_import
File "C:Program
FilesWindowsAppsPythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0
libimportlib__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:UsersbwilliamsonDesktopCSCppp-p1-types-variables-functionstask3a.py", line 40,
in <module>
table_volume = table_vol(TABLE_TOP_LENGTH, TABLE_TOP_WIDTH,
TABLE_TOP_HEIGHT, TABLE_LEG_BASE_RADIUS, TABLE_LEG_HEIGHT)
File "C:UsersbwilliamsonDesktopCSCppp-p1-types-variables-functionstask3a.py", line 33,
in table_vol
leg_vol = cylinder_vol(leg_base_rad, leg_height)
File "C:UsersbwilliamsonDesktopCSCppp-p1-types-variables-functionstask3a.py", line 23,
in cylinder_vol
return 3.14.pi * base_radius ** 2 * height
AttributeError: 'float' object has no attribute 'pi'
[INFO] 2023-02-25 GMT-0500 08:21:50.781: Finding files for cleanup.
[INFO] 2023-02-25 GMT-0500 08:21:50.782: Cleanup finished.
[INFO] 2023-02-25 GMT-0500 08:21:50.782: Submission process FINISHED.
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 + n r ) n t - 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 activity.

Más contenido relacionado

Similar a # TODO 1- Define the constants as instructed in the writeup and assign.pdf

Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersSheila Sinclair
 
Lecture_Activities_4.1_to_4.7.pdf.pdf
Lecture_Activities_4.1_to_4.7.pdf.pdfLecture_Activities_4.1_to_4.7.pdf.pdf
Lecture_Activities_4.1_to_4.7.pdf.pdfNancySantos49
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfayush616992
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfpnaran46
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on rAbhik Seal
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxgilpinleeanna
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Visual Basic Review - ICA
Visual Basic Review - ICAVisual Basic Review - ICA
Visual Basic Review - ICAemtrajano
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxlorindajamieson
 
Bis 311 final examination answers
Bis 311 final examination answersBis 311 final examination answers
Bis 311 final examination answersRandalHoffman
 
Chapter 16 Inference for RegressionClimate ChangeThe .docx
Chapter 16 Inference for RegressionClimate ChangeThe .docxChapter 16 Inference for RegressionClimate ChangeThe .docx
Chapter 16 Inference for RegressionClimate ChangeThe .docxketurahhazelhurst
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docxgilbertkpeters11344
 
Please distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdfPlease distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdfneerajsachdeva33
 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 solIIUM
 

Similar a # TODO 1- Define the constants as instructed in the writeup and assign.pdf (19)

Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
 
Lecture_Activities_4.1_to_4.7.pdf.pdf
Lecture_Activities_4.1_to_4.7.pdf.pdfLecture_Activities_4.1_to_4.7.pdf.pdf
Lecture_Activities_4.1_to_4.7.pdf.pdf
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdf
 
Savitch ch 02
Savitch ch 02Savitch ch 02
Savitch ch 02
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdf
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on r
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Visual Basic Review - ICA
Visual Basic Review - ICAVisual Basic Review - ICA
Visual Basic Review - ICA
 
C++ chapter 2
C++ chapter 2C++ chapter 2
C++ chapter 2
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
 
Bis 311 final examination answers
Bis 311 final examination answersBis 311 final examination answers
Bis 311 final examination answers
 
Chapter 16 Inference for RegressionClimate ChangeThe .docx
Chapter 16 Inference for RegressionClimate ChangeThe .docxChapter 16 Inference for RegressionClimate ChangeThe .docx
Chapter 16 Inference for RegressionClimate ChangeThe .docx
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
 
Compilers
CompilersCompilers
Compilers
 
Please distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdfPlease distinguish between the .h and .cpp file, create a fully work.pdf
Please distinguish between the .h and .cpp file, create a fully work.pdf
 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 sol
 

Más de NeiltrjGreenez

- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdf
- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdf- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdf
- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdfNeiltrjGreenez
 
(42) How does a monopoly maintain its monopoly 433- What is a natural.pdf
(42) How does a monopoly maintain its monopoly 433- What is a natural.pdf(42) How does a monopoly maintain its monopoly 433- What is a natural.pdf
(42) How does a monopoly maintain its monopoly 433- What is a natural.pdfNeiltrjGreenez
 
(1) What is technology and how does it relate to a firm's PPF (or its.pdf
(1) What is technology and how does it relate to a firm's PPF (or its.pdf(1) What is technology and how does it relate to a firm's PPF (or its.pdf
(1) What is technology and how does it relate to a firm's PPF (or its.pdfNeiltrjGreenez
 
- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdf
- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdf- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdf
- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdfNeiltrjGreenez
 
- Study the sample financial statements document uploaded on Canvas- N.pdf
- Study the sample financial statements document uploaded on Canvas- N.pdf- Study the sample financial statements document uploaded on Canvas- N.pdf
- Study the sample financial statements document uploaded on Canvas- N.pdfNeiltrjGreenez
 
#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdf
#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdf#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdf
#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdfNeiltrjGreenez
 
- 1- T or F-Current liabilities are separated from long term liabiliti.pdf
- 1- T or F-Current liabilities are separated from long term liabiliti.pdf- 1- T or F-Current liabilities are separated from long term liabiliti.pdf
- 1- T or F-Current liabilities are separated from long term liabiliti.pdfNeiltrjGreenez
 
(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdf
(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdf(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdf
(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdfNeiltrjGreenez
 
(This task uses Strings-) A program that prompts the user for their pa.pdf
(This task uses Strings-) A program that prompts the user for their pa.pdf(This task uses Strings-) A program that prompts the user for their pa.pdf
(This task uses Strings-) A program that prompts the user for their pa.pdfNeiltrjGreenez
 
(rather than herbaceous) in that the sylem often displays secondary gr.pdf
(rather than herbaceous) in that the sylem often displays secondary gr.pdf(rather than herbaceous) in that the sylem often displays secondary gr.pdf
(rather than herbaceous) in that the sylem often displays secondary gr.pdfNeiltrjGreenez
 
(Python) A variable defined inside a function is a local variable- oth.pdf
(Python) A variable defined inside a function is a local variable- oth.pdf(Python) A variable defined inside a function is a local variable- oth.pdf
(Python) A variable defined inside a function is a local variable- oth.pdfNeiltrjGreenez
 
(Python) Create a function that can take in either a list or a diction.pdf
(Python) Create a function that can take in either a list or a diction.pdf(Python) Create a function that can take in either a list or a diction.pdf
(Python) Create a function that can take in either a list or a diction.pdfNeiltrjGreenez
 
(Python) Create a function that prints the number of Keys and Values.pdf
(Python)  Create a function that prints the number of Keys and Values.pdf(Python)  Create a function that prints the number of Keys and Values.pdf
(Python) Create a function that prints the number of Keys and Values.pdfNeiltrjGreenez
 
(In C++) In a linked list containing student names (string) and their.pdf
(In C++) In a linked list containing student names (string) and their.pdf(In C++) In a linked list containing student names (string) and their.pdf
(In C++) In a linked list containing student names (string) and their.pdfNeiltrjGreenez
 
(Multiple answers) Choose all of the following that are considered ris.pdf
(Multiple answers) Choose all of the following that are considered ris.pdf(Multiple answers) Choose all of the following that are considered ris.pdf
(Multiple answers) Choose all of the following that are considered ris.pdfNeiltrjGreenez
 
(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdf
(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdf(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdf
(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdfNeiltrjGreenez
 
(ii) There were 500 insects in the total population- In this populatio.pdf
(ii) There were 500 insects in the total population- In this populatio.pdf(ii) There were 500 insects in the total population- In this populatio.pdf
(ii) There were 500 insects in the total population- In this populatio.pdfNeiltrjGreenez
 
(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdf
(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdf(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdf
(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdfNeiltrjGreenez
 
(In java) Create a method to delete a node at a particular position i.pdf
(In java)  Create a method to delete a node at a particular position i.pdf(In java)  Create a method to delete a node at a particular position i.pdf
(In java) Create a method to delete a node at a particular position i.pdfNeiltrjGreenez
 

Más de NeiltrjGreenez (20)

- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdf
- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdf- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdf
- Unpovecied anal indercoarse P Poriable digital a aristant 5 HW infec.pdf
 
(42) How does a monopoly maintain its monopoly 433- What is a natural.pdf
(42) How does a monopoly maintain its monopoly 433- What is a natural.pdf(42) How does a monopoly maintain its monopoly 433- What is a natural.pdf
(42) How does a monopoly maintain its monopoly 433- What is a natural.pdf
 
(1) What is technology and how does it relate to a firm's PPF (or its.pdf
(1) What is technology and how does it relate to a firm's PPF (or its.pdf(1) What is technology and how does it relate to a firm's PPF (or its.pdf
(1) What is technology and how does it relate to a firm's PPF (or its.pdf
 
- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdf
- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdf- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdf
- Simulate the circuit of the Hexadecimal to 7-segment display decoder.pdf
 
- Study the sample financial statements document uploaded on Canvas- N.pdf
- Study the sample financial statements document uploaded on Canvas- N.pdf- Study the sample financial statements document uploaded on Canvas- N.pdf
- Study the sample financial statements document uploaded on Canvas- N.pdf
 
#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdf
#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdf#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdf
#include -sys-types-h- #include -stdio-h- #include -unistd-h- #define.pdf
 
- 1- T or F-Current liabilities are separated from long term liabiliti.pdf
- 1- T or F-Current liabilities are separated from long term liabiliti.pdf- 1- T or F-Current liabilities are separated from long term liabiliti.pdf
- 1- T or F-Current liabilities are separated from long term liabiliti.pdf
 
(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdf
(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdf(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdf
(Stock dividends) In the spring of 2016- the CFO of HTPL Distributing.pdf
 
(This task uses Strings-) A program that prompts the user for their pa.pdf
(This task uses Strings-) A program that prompts the user for their pa.pdf(This task uses Strings-) A program that prompts the user for their pa.pdf
(This task uses Strings-) A program that prompts the user for their pa.pdf
 
(rather than herbaceous) in that the sylem often displays secondary gr.pdf
(rather than herbaceous) in that the sylem often displays secondary gr.pdf(rather than herbaceous) in that the sylem often displays secondary gr.pdf
(rather than herbaceous) in that the sylem often displays secondary gr.pdf
 
(Python) A variable defined inside a function is a local variable- oth.pdf
(Python) A variable defined inside a function is a local variable- oth.pdf(Python) A variable defined inside a function is a local variable- oth.pdf
(Python) A variable defined inside a function is a local variable- oth.pdf
 
(Python) Create a function that can take in either a list or a diction.pdf
(Python) Create a function that can take in either a list or a diction.pdf(Python) Create a function that can take in either a list or a diction.pdf
(Python) Create a function that can take in either a list or a diction.pdf
 
(Python) Create a function that prints the number of Keys and Values.pdf
(Python)  Create a function that prints the number of Keys and Values.pdf(Python)  Create a function that prints the number of Keys and Values.pdf
(Python) Create a function that prints the number of Keys and Values.pdf
 
(Pskip)-skip.pdf
(Pskip)-skip.pdf(Pskip)-skip.pdf
(Pskip)-skip.pdf
 
(In C++) In a linked list containing student names (string) and their.pdf
(In C++) In a linked list containing student names (string) and their.pdf(In C++) In a linked list containing student names (string) and their.pdf
(In C++) In a linked list containing student names (string) and their.pdf
 
(Multiple answers) Choose all of the following that are considered ris.pdf
(Multiple answers) Choose all of the following that are considered ris.pdf(Multiple answers) Choose all of the following that are considered ris.pdf
(Multiple answers) Choose all of the following that are considered ris.pdf
 
(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdf
(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdf(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdf
(Multiple answers) Choose all that are risk factors for CVD- HTN famil.pdf
 
(ii) There were 500 insects in the total population- In this populatio.pdf
(ii) There were 500 insects in the total population- In this populatio.pdf(ii) There were 500 insects in the total population- In this populatio.pdf
(ii) There were 500 insects in the total population- In this populatio.pdf
 
(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdf
(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdf(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdf
(i) When the savings rate is 1-3- what is the fiscal multiplier (you c.pdf
 
(In java) Create a method to delete a node at a particular position i.pdf
(In java)  Create a method to delete a node at a particular position i.pdf(In java)  Create a method to delete a node at a particular position i.pdf
(In java) Create a method to delete a node at a particular position i.pdf
 

Último

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 

Último (20)

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 

# TODO 1- Define the constants as instructed in the writeup and assign.pdf

  • 1. # TODO 1: Define the constants as instructed in the writeup and assign them # the correct values. INITIAL_PRINCIPAL = 10000.0 YEARS = 5 ACCOUNT_RATE_1 = 0.027 ACCOUNT_RATE_2 = 0.0268 ACCOUNT_RATE_3 = 0.0266 ACCOUNT_CMP_FREQ_1 = 1 ACCOUNT_CMP_FREQ_2 = 12 ACCOUNT_CMP_FREQ_3 = 365 # TODO 2: Implement the `amount_after_n_years` function. def amount_after_n_years(init_principal, acc_rate, acc_cmp_freq, years): n = acc_cmp_freq r = acc_rate t = years A = init_principal * (1 + r/n)**(n*t) return A # TODO 3: Define the 3 `amount_*` variables and assign them the values as # instructed in the writeup. c1 = 10000 * (1 + 0.027) ** 5 c2 = 10000 * (1 + 0.0268 / 12) ** (5 * 12) c3 = 10000 * (1 + 0.0266 / 365) ** (5 * 365)
  • 2. def main(): print(c1, c2, c3) print(max(c1, c2, c3)) amount_1 = amount_after_n_years(INITIAL_PRINCIPAL, ACCOUNT_RATE_1, ACCOUNT_CMP_FREQ_1, YEARS) amount_2 = amount_after_n_years(INITIAL_PRINCIPAL, ACCOUNT_RATE_2, ACCOUNT_CMP_FREQ_2, YEARS) amount_3 = amount_after_n_years(INITIAL_PRINCIPAL, ACCOUNT_RATE_3, ACCOUNT_CMP_FREQ_3, YEARS) if __name__ == "__main__": # TODO 4: Follow the instructions in the writeup to comment out the two # print statements and uncomment the remaining lines of the code # block. main() # print(f"Account option 1 will hold ${amount_1:,.2f}.") # print(f"Account option 2 will hold ${amount_2:,.2f}.") # print(f"Account option 3 will hold ${amount_3:,.2f}.") # print(f"The maximum amount that can be reached is " # f"${max(amount_1, amount_2, amount_3):,.2f}.") print("After {} years, the initial principal of {:.2f} in account 1 with an interest rate of {} compounded {} times per year would grow to {:.2f}.".format(YEARS, INITIAL_PRINCIPAL, ACCOUNT_RATE_1, ACCOUNT_CMP_FREQ_1, amount_1)) print("After {} years, the initial principal of {:.2f} in account 2 with an interest rate of {} compounded {} times per year would grow to {:.2f}.".format(YEARS, INITIAL_PRINCIPAL, ACCOUNT_RATE_2, ACCOUNT_CMP_FREQ_2, amount_2))
  • 3. print("After {} years, the initial principal of {:.2f} in account 3 with an interest rate of {} compounded {} times per year would grow to {:.2f}.".format(YEARS, INITIAL_PRINCIPAL, ACCOUNT_RATE_3, ACCOUNT_CMP_FREQ_3, amount_3)) Submission log file: [ERROR] 2023-02-25 GMT-0500 08:21:50.778: An unexpected error has occurred. Traceback (most recent call last): File "<string>", line 74, in run File "<string>", line 31, in generate_submission_archive File "<string>", line 51, in __list_files_for_submission File "<string>", line 65, in __generate_task_specific_files File "<string>", line 138, in task3 File "<string>", line 24, in silent_import File "<string>", line 22, in silent_import File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0 libimportlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "C:UsersbwilliamsonDesktopCSCppp-p1-types-variables-functionstask3a.py", line 40, in <module>
  • 4. table_volume = table_vol(TABLE_TOP_LENGTH, TABLE_TOP_WIDTH, TABLE_TOP_HEIGHT, TABLE_LEG_BASE_RADIUS, TABLE_LEG_HEIGHT) File "C:UsersbwilliamsonDesktopCSCppp-p1-types-variables-functionstask3a.py", line 33, in table_vol leg_vol = cylinder_vol(leg_base_rad, leg_height) File "C:UsersbwilliamsonDesktopCSCppp-p1-types-variables-functionstask3a.py", line 23, in cylinder_vol return 3.14.pi * base_radius ** 2 * height AttributeError: 'float' object has no attribute 'pi' [INFO] 2023-02-25 GMT-0500 08:21:50.781: Finding files for cleanup. [INFO] 2023-02-25 GMT-0500 08:21:50.782: Cleanup finished. [INFO] 2023-02-25 GMT-0500 08:21:50.782: Submission process FINISHED. 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 + n r ) n t - 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
  • 5. 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 activity.