Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions