Another functionality for the app is the ability to estimate the return on investment over a period of time. In order to implement this feature, you will have to update the investment calculator algorithm. The base function to calculate the return on investment from Task 1 can be reutilized here to simplify our task. This feature will take into consideration a 12-month period by default. To calculate the total amount earned over a period of time, you will have to loop through the n-months period, increase the amount for each period. The other rules from the previous task apply here as well. For example: If you invest $3 million on the first month, and obtain a return of $93,000 dollars, then the amount to be invested in the second month is $3.093 million. To summarize: Loop over a period of 12 months to calculate the total for each period Return the accumulated estimated value for a period of 12 months
Another functionality for the app is the ability to estimate the return on investment over a period of time. In order to implement this feature, you will have to update the investment calculator algorithm. The base function to calculate the return on investment from Task 1 can be reutilized here to simplify our task. This feature will take into consideration a 12-month period by default. To calculate the total amount earned over a period of time, you will have to loop through the n-months period, increase the amount for each period. The other rules from the previous task apply here as well. For example: If you invest $3 million on the first month, and obtain a return of $93,000 dollars, then the amount to be invested in the second month is $3.093 million. To summarize: Loop over a period of 12 months to calculate the total for each period Return the accumulated estimated value for a period of 12 months
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Another functionality for the app is the ability to estimate the return on investment over a period of time. In order to implement this feature, you will have to update the investment calculator algorithm .
The base function to calculate the return on investment from Task 1 can be reutilized here to simplify our task. This feature will take into consideration a 12-month period by default.
To calculate the total amount earned over a period of time, you will have to loop through the n-months period, increase the amount for each period. The other rules from the previous task apply here as well.
For example: If you invest $3 million on the first month, and obtain a return of $93,000 dollars, then the amount to be invested in the second month is $3.093 million.
To summarize:
Loop over a period of 12 months to calculate the total for each period
Return the accumulated estimated value for a period of 12 months

Transcribed Image Text:vestment function
S
R
calculate_gains.py X calculate_gains_ov... X
+
1 The following base code is given for you.
2 def calculate_gains_over_time (amount_inv=0.0, period=12):
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
%
|| || ||
5
Calculating the return gains of a given amount invested based on a period of appl
:param amount_inv: the money amount invested
:param period: application period
:return:
amount
# calculate the first period before entering the loop
# call the base calculate_gains` function to estimate the gains for the first pe
i
#loop through the specified period to calculate the gain of each month.
# 1 to period-1 because the first period gains is already calculated above
# call the function to update the value based on the period inside the loop a
# return the final ammount
return new amount
G Search or type URL
T
new_amount = total_amount # update the new_amount variable
SBN=9780357421802&id=15264176... ☆
A
MacBook Pro
6
Y
&
7
U
*
Tp Paused
8
(
9
O
)
Q Search this cours
F
P
0
+
—
11
O
}
B

Transcribed Image Text:nvestment function
$
R
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
calculate_gains.py X calculate_gains_ov... X +
:param period: application period
:return:
%
5
# call the base calculate_gains` function to estimate the gains for the first
# calculate the first period before entering the loop
amount
21
22
23
24
25
26
27
28
29
30
31 print (calculate_gains_over_time (amount_inv=4000000, period=12))
32
#loop through the specified period to calculate the gain of each month
# 1 to period-1 because the first period gains is already calculated above
# call the function to update the value based on the period inside the loop
T
new_amount = total amount # update the new_amount` variable
I
# return the final ammount
return new_amount
↓
G Search or type URL
MacBook Pro
6
Y
&
7
U
* CO
8
1
9
0
O
)
. O
Q Search th
P
A
3
+
11
T
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education