Question: from math import ceil def simulate_infection_pp(population, initial_infected, r_number): # Initialize variables infected = initial_infected deceased = 0 day = 1 # Print the initial state
from math import ceil
def simulate_infection_pp(population, initial_infected, r_number):
# Initialize variables
infected = initial_infected
deceased = 0
day = 1
# Print the initial state of the population on day 1
print(day, population)
# Run the simulation until the entire population is deceased
while population > deceased:
# Increment the day
day += 1
# Update total number of deceased animals
deceased += infected
# Update the number of currently infected animals
infected = ceil(infected * r_number)
# Calculate the remaining alive population
alive_population = population - deceased
# Print the day and the number of alive animals
# print(day, alive_population)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
