Question
Write a function called bacteria that will print out the number of bacteria in a Petri dish as time goes by. The function has two
Write a function called bacteria that will print out the number of bacteria in a Petri dish as time goes by. The function has two parameters. The first is an integer giving the number of minutes it takes for a bacterium to split into two new bacteria. The second is an integer giving the number of bacterial generations to include in the output. Assume you always begin with a single bacterium in the dish and every bacterium always splits into exactly two bacteria at the end of each time period.
Here's what I have thus far (but when it test it, it's incorrect):
def bacteria(minute_intervals, number): ''' This function prints out the number of bacteria in a Petri dish as time passes. ''' num=1 for i in range(1, number): print("after", (minute_intervals*i), "minutes:", (2**i), "bacteria") num += 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started