Answer:
- import math
- start_pop = int(input("Enter start population: "))
- daily_increase = float(input("Daily population increase: "))
- num_days = int(input("Number of day multiplied: "))
-
- pop_size = start_pop
-
- for i in range(1, num_days+1):
- pop_size += pop_size * daily_increase
- print("Day " + str(i) + ": " + str(math.floor(pop_size)))
Step-by-step explanation:
The solution code is written in Python 3
Since we wish to round the population size to integer, we need to import math module to use its floor method in a later stage (Line 1)
Next, prompt user input for start population, daily increase percent and number of day they will multiply (Line 2 -4)
Next create a variable pop_size and set the start_pop as initial value
Create a for loop that run num_days of rounds and within the loop apply the formula to increase the population size based on the daily_increase rate and print it to console (Line 8 -10).