A local biologist needs a program to predict population growth. the inputs would 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 .
Explanation / Answer
def predict_population(): import math sp = input("What is the starting population? ") r = input("What is the rate of population growth (between 0 and 1)? ") while r > 1 or r < 0: print "Invalid population growth rate." r = input("Please enter a valid rate: ") t = input("How many years to predict? ") for i in range(t): tp = sp * math.exp(r*i) print "The population after",i,"years will be",tp predict_population()