Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

procreate(orgl,popSize,mutProb) You will now write a function called procreate that takes a list of organisms orgL as input. It causes these to reproduce a population

image text in transcribed

procreate(orgl,popSize,mutProb) You will now write a function called procreate that takes a list of organisms orgL as input. It causes these to reproduce a population of popSize progeny organisms which it returns as a list. Replication is done with a probability of mutation mutProb. The simulator functions which you write below will call procreate in order to produce the next generation of organisms. procreate should operate by sampling (with replacement) an organism, calling that organisms's.replicate method to reproduce, and storing the resulting progeny organism in a list. It should repeat this process until it has produced a new list of organisms popSize large. Sampling with replacement can be accomplished using random.choice(L), where L is a list. For example: >>> import random >>> exampleL=['h','i','v'] >>> random.choice (exampleL) # because this uses randomness, you'll get different results each time you call it Ti' >>> random.choice (exampleL) 'v' procreate(orgl,popSize,mutProb) You will now write a function called procreate that takes a list of organisms orgL as input. It causes these to reproduce a population of popSize progeny organisms which it returns as a list. Replication is done with a probability of mutation mutProb. The simulator functions which you write below will call procreate in order to produce the next generation of organisms. procreate should operate by sampling (with replacement) an organism, calling that organisms's.replicate method to reproduce, and storing the resulting progeny organism in a list. It should repeat this process until it has produced a new list of organisms popSize large. Sampling with replacement can be accomplished using random.choice(L), where L is a list. For example: >>> import random >>> exampleL=['h','i','v'] >>> random.choice (exampleL) # because this uses randomness, you'll get different results each time you call it Ti' >>> random.choice (exampleL) 'v

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

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions

Question

You have

Answered: 1 week ago