1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marusya05 [52]
3 years ago
10

Complete the function doubling_time that takes two parameters bal and apr and uses a while loop compute the number of years it t

akes for the initial balance in a bank account to double in value rounded up to the nearest year. The two parameters are: bal: initial balance in the bank account apr: annual percent interest income, this is the percentage (of the balance) that should be added to the balance every year as interest income. For example, if bal is 200 and apr is 10 then the balance should be 220 after the first year. Provided definition: # returns the doubling time of the balance in whole years def doubling_time (bal, apr):
Computers and Technology
1 answer:
worty [1.4K]3 years ago
4 0

Answer:

  1. def doubling_time(bal, apr):
  2.    current_amount = bal  
  3.    year = 0
  4.    while(current_amount < bal * 2):
  5.        current_amount = current_amount + (current_amount * apr/ 100)
  6.        year += 1
  7.    
  8.    return year
  9. print(doubling_time(200, 10))

Explanation:

The solution is written in Python 3.

Firstly create a function that takes two input bal and apr (Line 1). Next set the bal as current amount (Line 2) and create year variable as a counter of year (Line 3).

Create a while loop and set the loop condition to enable the while loop persist so long as the current amount still less than the double of initial balance (Line 4). In the while loop, apply formula to compute the current amount after adding the annual interest and then increment year counter by one (Line 5 -6). The year counter will keep increment until the current amount is double the initial balance and terminate the while loop. Return the year counter as function output (Line 8).

We test the function by passing 200 and 10 as initial balance and annual interest rate, respectively. We shall get return value 8.

You might be interested in
Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in
JulsSmile [24]

Answer:

def max_magnitude(user_val1, user_val2):

if abs(user_val1) > abs(user_val2):

return user_val1

else:

return user_val2

if __name__ == '__main__':

n1 = int(input("Enter the first integer number: "))

n2 = int(input("Enter the second integer number: "))

print("The largest magnitude value of", n1, "and", n2, "is", max_magnitude(n1, n2))

Explanation:

5 0
3 years ago
How does a filmmaker decide which events to include in a documentary?
Liono4ka [1.6K]

Answer:

A documentary is a film based on facts in which the maker tries to portray an aspect of reality, such as politics, science, society or history, nature or the personal perception of the documentary maker.

Documentaries are informative in nature. Sometimes documentaries attempt to provide an objective picture of a subject. There is a lot of debate about what is objective, because the documentary maker chooses his images from reality, which is in itself a subjective act. In a creative author's documentary, the emphasis is on the subjective vision of the filmmaker.

Therefore, the documentary maker will select the events to include in the documentary according to the approach he or she wants to give to it, be it objective or subjective.

8 0
3 years ago
When a relationship is established between two or more arrays by using the same subscript to relate entries between the arrays,
zmey [24]

Answer: Parallel Array

Explanation:

Multiple arrays can be grouped together within a structure which is known as parallel array. Here the arrays are related by a common entry such as ith element in a arrays is related to the ith element  of the other array.

5 0
3 years ago
Read 2 more answers
What structure in the eye plays a role in accommodation by holding the lens in place?
Neko [114]
<span>The answer is Ciliary body.  It is the </span>structure in the eye that plays a role in accommodation by holding the lens in place.  <span>The </span>ciliary body<span> has 3 </span>functions<span>: 1) accommodation  2) aqueous humor production and resorption                      3) maintenance of the lens zonules for the purpose of securing the lens in place.</span>
7 0
4 years ago
What is the relationship between the binary number system and computer hardware?
Law Incorporation [45]
The binary number system, also called the base-2 number system, is a method of representing numbers that counts by using combinations of only two numerals: zero (0) and one (1). Computers use the binary number system to manipulate and store all of their data including numbers, words, videos,etc.
3 0
3 years ago
Other questions:
  • (True or False)
    8·2 answers
  • If I gain a rank and go under the points that the rank coust do I lose the rank
    8·2 answers
  • A junior network administrator has used the wrong cable type to connect his/her computer to the administrative port on a router
    7·1 answer
  • How does kinetic energy affect the stopping distance of a vehicle traveling at 30 mph compared to the same vehicle traveling at
    6·1 answer
  • What are three recommendations for reducing risk and improving the privacy of your personal information while using social media
    13·1 answer
  • 1. Build and test D-type Flip-Flop using a built-in SR flip-flop.
    12·1 answer
  • Someone please help will mark as brainliest
    8·2 answers
  • Five real world objects with similar characteristics​
    6·1 answer
  • Study the graph and answer the questions. The numbers on the left side of the graph are in thousands.
    13·1 answer
  • What are the two broad categories that individual definitional techniques fall under? Check all that apply. Demonstrative defini
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!