about | help | code help+videos | done | prefs |
bacteria
Suppose a bacteria colony grows at a rate of 0.1*dt per small fraction dt of an hour. Suppose the initial number of bacteria is p. Create a difference equation to model the number of bacteria B(t) at time t. Write a function bacteria(p, dt, days) that uses your difference equation to compute and return the number of bacteria in the colony after the given number of days. The other parameters, population and dt, are the initial size of the colony and the step size (dt), respectively. Make sure you also know how to modify your code to plot the population size using matplotlib. Your code should cast your final answer to an integer before returning it. bacteria(100, 0.01, 2) → 12134 bacteria(10, 1, 3) → 10511 bacteria(400, 0.03, 5) → 64134690 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy