Create a user-defined function called calculate_gains(), which receives the amount desired to be invested. Outside this function, create a global variable, multiplier_amount that would be accessible at any point in your code to store the "multiplier amount", which will be the amount that would trigger the increase on the gain margin in case the invested amount is greater than this value. In our case, this amount is set to 1 million. Inside your function, create a variable to store the gain margin, which is 0.1% by default. Also create variables for total_gains and total_amount, setting default values to 0. After these declarations, the first thing to check is whether the amount invested is greater than 1000 (one thousand), which is the minimum application value to start using the app. Next, check if the amount is greater than the multiplier value (1 million). If it is greater, then update the gain margin variable with the new gain margin and add the estimated amount to the original amount, otherwise just multiply the values to obtain the return on investment for the given amount. Finally, you need to return the total gains amount, the amount invested updated with the return on investment added to it, as well as the gain margin (the ordering is important for testing purposes). To test your function, enter the following amount: 2000000 ($2 million). To summarize: • In the user-defined function declare a global variable inside the python file to store the multiplier amount. • Declare a variable to store the gain margin. • Declare variables to store the total gains and the total amount. • Check if the amount is greater than the minimum value (which is 1000). • Check if the amount is greater than the multiplier amount (which is 1000000). • If so, update the gain margin. • Calculate the total gains by multiplying the gain margin by the amount. • Return the total gains, total updated amount, and gain margin.

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
icon
Related questions
Question
Create a user-defined function called calculate_gains(), which receives the amount desired to be invested. Outside this function, create a global variable, multiplier_amount that would be accessible at any point in your code to store the "multiplier amount", which will be the amount that would trigger the increase on the gain margin in case the invested amount is greater than this value. In our case, this amount is set to 1 million. Inside your function, create a variable to store the gain margin, which is 0.1% by default. Also create variables for total_gains and total_amount, setting default values to 0. After these declarations, the first thing to check is whether the amount invested is greater than 1000 (one thousand), which is the minimum application value to start using the app. Next, check if the amount is greater than the multiplier value (1 million). If it is greater, then update the gain margin variable with the new gain margin and add the estimated amount to the original amount, otherwise just multiply the values to obtain the return on investment for the given amount. Finally, you need to return the total gains amount, the amount invested updated with the return on investment added to it, as well as the gain margin (the ordering is important for testing purposes). To test your function, enter the following amount: 2000000 ($2 million). To summarize: • In the user-defined function declare a global variable inside the python file to store the multiplier amount. • Declare a variable to store the gain margin. • Declare variables to store the total gains and the total amount. • Check if the amount is greater than the minimum value (which is 1000). • Check if the amount is greater than the multiplier amount (which is 1000000). • If so, update the gain margin. • Calculate the total gains by multiplying the gain margin by the amount. • Return the total gains, total updated amount, and gain margin.
nction
8
9
0
1
2
3
4
5
26
27
28
calculate_gains.py X calculate_gains_ov... X
#global variable
# base amount gain margin
def calculate_gains (amount_inv=0.0):
""" Calculating the return gains of an investment.
№=9780357421802&snapshotid=...
if amount_inv > 1000:
# check whether the invested amount is greater than the multiplier amount
#gather the value of the division
# update the gain_margin` by the multiplier mod
# calculate the total amount of gains
A
+
# calculate the total amount plus the gain margin
# return the gains, the full amount and the gain margin
MacBook Pro
The
&
*
They
O
Трехп Paused
C
I
Q Search this cours
I
+
11
I
>_
O
Transcribed Image Text:nction 8 9 0 1 2 3 4 5 26 27 28 calculate_gains.py X calculate_gains_ov... X #global variable # base amount gain margin def calculate_gains (amount_inv=0.0): """ Calculating the return gains of an investment. №=9780357421802&snapshotid=... if amount_inv > 1000: # check whether the invested amount is greater than the multiplier amount #gather the value of the division # update the gain_margin` by the multiplier mod # calculate the total amount of gains A + # calculate the total amount plus the gain margin # return the gains, the full amount and the gain margin MacBook Pro The & * They O Трехп Paused C I Q Search this cours I + 11 I >_ O
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data Binding
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
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education