Andrew K.
asked 03/22/21Unit_5_Lab_2...
submit one .py file.
A local biologist needs a program to predict population growth. The
inputs would be:
the initial number of organisms,
the rate of growth (a real number greater than 0),
the number of hours it takes to achieve this rate,
and 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.
Eg. Output in this format:
#organisms growth_rate hours achieve rate total_hours #organisms
500 2x 6.00 6.00 1,000
1,000 2x 6.00 12.00 2,000
2,000 2x 6.00 18 .00 4,000
1 Expert Answer

Patrick B. answered 03/23/21
Math and computer tutor/teacher
P0 = -1
while (float(P0)<=0):
P0 = input(" How many initial population ??? :>")
R=-1
while float(R)<0:
R = input(" Please input the growth rate :>")
t = -1
while float(t)<0:
t = input("please input the time :>")
N = -1
while int(N)<0:
N = input(" how many interations ??? :>")
print(" initial population = " + str(P0) + " : growth rate = " + str(R) + " : time = " + str(t) + " : " + str(N) + " iterations ")
P = P0
print("Time Population")
for i in range(int(N)):
timeT = int(i)*float(t)
print(" " + str(timeT) + " " + str(P))
P = float(R)*float(P)
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Andrew K.
#organisms growth_rate hours achieve rate total_hours 500 2x 6.00 6.00 1,000 2x 6.00 12.00 2,000 2x 6.00 18 .0003/22/21