Question: Task 1 : Write a program in the file population.py that takes these inputs and displays a prediction of the total population. please correct this

Task 1: Write a program in the file population.py that takes these inputs and displays a prediction of the total population.
please correct this code
# Input values
def predict_population():
# Get input values
initial_population = int(input("Enter the initial number of organisms: "))
growth_rate = float(input("Enter the rate of growth [a real number >0]: "))
time_to_achieve_rate = int(input("Enter the number of hours to achieve the rate of growth: "))
total_hours = int(input("Enter the total hours of growth: "))
# Calculate the total population
time_periods = total_hours // time_to_achieve_rate
total_population = initial_population *(1+ growth_rate)** time_periods
# Display the prediction
print(f"The total population is: {int(total_population)}")
# Run the program
predict_population()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!