Solution: Automate the Repeated Tasks and Simulate the Data

Let's look at the solution of the previous exercise.

We'll cover the following

Solution

The assignment asks us to introduce a new argument that will modify how many prey animals are used in each trial. In the current version, the number of prey is fixed at 10 per trial. But if we replace that number with an argument, let’s call it numPrey, we can adjust the number of prey in different trials. Note that there are three places where we need to replace the number 10 with the new argument numPrey. We can verify it worked by running a few examples:

Get hands-on with 1200+ tech skills courses.