Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

2.) Write a function called bacteria that will print out the number of bacteria in a Petri dish as time goes by. The function has

image text in transcribed

2.) 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 are some examples of calling the function with different arguments. (The code executed is in blue, the output produced is in green): bacteria (10, 5) after 10 minutes: 2 bacteria after 20 minutes: bacteria after 30 minutes: 8 bacteria after 40 minutes: 16 bacteria after 50 minutes 32 bacteria bacteria (21, 3) after 21 minutes: 2 bacteria after 42 minutes: bacteria after 63 minutes:8 bacteria

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_2

Step: 3

blur-text-image_3

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

More Books

Students explore these related Databases questions