id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs111fall2019 > SIS
prev  |  next  |  chance

The SIS model represents an infection that does not result in immunity. In other words, there is no "recovered" population; people who have recovered re-enter the "susceptible" population. Write a difference equation for this model. Implement your difference equation using a for loop. Your model should take as parameter an initial population size, a step size dt, a number of days for the model to run, an infection rate, and a recovery rate. Assume there is one infected person to start and the rest of the population is susceptible. Your for loop should iterate int(days/dt)+1 times. End your function with the line return int(susceptible)


SIS(100, 1, 5, 4.0E-4, 0.25) → 99
SIS(100, 0.1, 10, 0.003, 0.25) → 98
SIS(500, 0.05, 7, 0.005, 0.2) → 40

...Save, Compile, Run (ctrl-enter)

def SIS(population, dt, days,infRate,recRate):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy