Question

Please use python with a for loop to explain. Thanks in advance for the help! ^^...

Please use python with a for loop to explain. Thanks in advance for the help! ^^

A local biologist needs a program to predict population growth. The inputs would be:

  1. The initial number of organisms
  2. The rate of growth (a real number greater than 1)
  3. The number of hours it takes to achieve this rate
  4. A number of hours during which the population grows

For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate of 6 hours. Assuming that none of the organisms die, this would imply that this population would double in size every 6 hours. Thus, after allowing 6 hours for growth, we would have 1000 organisms, and after 12 hours, we would have 2000 organisms.

Write a program that takes these inputs and displays a prediction of the total population.

An example of the program input and output is shown below:

Enter the initial number of organisms: 10
Enter the rate of growth [a real number > 0]: 2
Enter the number of hours to achieve the rate of growth: 2
Enter the total hours of growth: 6

The total population is 80
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python code:

organisms = int(input("Enter the initial number of organisms: "))
rate = int(input("Enter the rate of growth(a real number >0): "))
hours = int(input("Enter the number of hours to achieve the rate of growth:"))
totalhours = int(input("Enter the total hours of growth:"))

finalorganisms =organisms

for i in range(0,totalhours,hours):
    finalorganisms*=rate
  
print("The total population is ",finalorganisms)

Execution screenshots:

Add a comment
Know the answer?
Add Answer to:
Please use python with a for loop to explain. Thanks in advance for the help! ^^...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For Python Instructions A local biologist needs a program to predict population growth. The inputs would...

    For Python Instructions A local biologist needs a program to predict population growth. The inputs would be: 1. The initial number of organisms 2. The rate of growth (a real number greater than 1) 3. The number of hours it takes to achieve this rate 4. A number of hours during which the pq, ulation grows For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate...

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives...

    Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print the sum of the numbers and their average. Q2. The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of...

  • Use the following information for the next 7 questions. You should draw a graph that depicts the situation below and use your picture to answer the questions Assume that wages and prices are stic...

    Use the following information for the next 7 questions. You should draw a graph that depicts the situation below and use your picture to answer the questions Assume that wages and prices are sticky and that we start at a long-run equilibrium. Assume that at this initial point, the growth rate of the money supply is 7%, the growth rate of the velocity of money is 0% and that the real economic growth rate is 3%. Now assume that there...

  • python Question 4: (Textbook Page 82, Q38) Python comes with hundreds of modules. Here is a...

    python Question 4: (Textbook Page 82, Q38) Python comes with hundreds of modules. Here is a challenge for you: find a module that you can import that will generate today's date so you can print it. Use your favorite search engine for help in finding which module you need and how to use it. In the end, write a program that prints today's date. For example, an execution could look like this: The date today is: 2015-09-18 Question 5: Suppose...

  • Java

    Create a Java class (program) called PopulationGrowth.java. This program will compute the growth rates of a population over time. The program should take the following inputs from the user:p, the initial population size in the range [1...1000]b, the per capita birth rate in the range [0.0...1.0)d, the per capita death rate in the range [0.0...1.0)time_span, the number of years for which to compute population totalsOnce the input is finished, the program must compute the population for the next time_span years and display each...

  • PLEASE HELP!! Clear steps for each part would be much appreciated. thank you! It's not just money that multiplies with time... Suppose the number of bacteria on the surface of a phone screen dou...

    PLEASE HELP!! Clear steps for each part would be much appreciated. thank you! It's not just money that multiplies with time... Suppose the number of bacteria on the surface of a phone screen doubles every 3 hours. 4. Write a function for the population, p, of bacteria as a function of n where n is the number of 3-hour periods since the bacteria first start multiplying. Call the initial population po a. b. How much will the population grow over...

  • Use the following information for the next 9 questions. You should draw a graph that depicts...

    Use the following information for the next 9 questions. You should draw a graph that depicts the situation below and use your picture to answer the questions. Assume that wages and prices are sticky and that we start at a long-run equilibrium. Assume that at this initial point, the growth rate of the money supply is 8%, the growth rate of the velocity of money is 0% and that the real economic growth rate is 5%. Now assume that the...

  • Python please help! Thanks you Write a code to get an unlimited number of grades from...

    Python please help! Thanks you Write a code to get an unlimited number of grades from the user (the user can press enter to finish the grades input, or use a sentinel, for example-1), and then calculate the GPA of all the grades and displays the GPA To do this you might need some help. Try to follow the following process (and check your progress by printing different values to make sure they are as they supposed to be): 1-...

  • need help!! c++ HW_6b - Calculate the average Use a do-while loop Write a program that...

    need help!! c++ HW_6b - Calculate the average Use a do-while loop Write a program that first prompts the user for an upper limit: Enter the number of entries: 5 € (user enters 5) After the user enters a number, the program should prompt the user to enter that many numbers. For example, if the user enters 5, then the program will ask the user to enter 5 values. Use a do-while loop to add the numbers. o With each...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT