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

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter5: Working With Multiple Worksheets And Workbooks
Section: Chapter Questions
Problem 4AYK
icon
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
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: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
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Hiring Problem
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L