Question: Need help creating a Foxes vs Rabbits population growth python 3 program: Imagine a population of Foxes and Rabbits living in an enclosed space. Each

Need help creating a Foxes vs Rabbits population growth python 3 program:

Imagine a population of Foxes and Rabbits living in an enclosed space. Each year, some animals are born and some die. Foxes will cause some of the rabbits to die. If the number of rabbits is too small, some foxes will die from starvation.

This problem can be modeled in a program.

At the start of recorded time, there are a starting number of Foxes and Rabbits.

For example, at year 0

R[0] = 5,891 F[0] = 16

After one year passes, the number of animals will change. We need to compute the birth-death amount for the year.

R[1] = R[0] + Floor( R[0] * (A-B * F[0]))

The number of foxes changes the number of births and deaths.

A similar change in the foxes is caused by the number of rabbits.

F[1] = F[0] Floor(F[0] * (G-S * R[0]))

A reasonable setting for these variables based on experimental data is.

A = 0.04 B = 0.0005 G = 0.2 S = 0.00005

After 1 year, the population looks like

R[1] = 5891+Floor(5891 * (0.04-0.0005 * 16)) = 6079 Rabbits

F[1] = 16 Floor(16 * (0.2-0.00005 * 5891)) = 18 Foxes

Write a function bunnies(rabbits, foxes, years) that takes three inputs, the starting number of rabbits, starting number of foxes, and number of years to simulate. Return a List with two items. Put the final number of rabbits at index 0 and final number of foxes at index 1.

It is impossible to have a fractional fox or rabbit. The floor function rounds down to the nearest integer.

For example, bunnies(5891,16,1) will return [6079,18].

Develop a user interface that askes the user for the initial number of rabbits, initial number of foxes, and number of years to run the simulation. Print out the final populations.

Your function will be auto-tests. Make sure to use the if name=="main": command around your input/output so ZyBooks can test your function.

An example execution trace is provided below.

Need help creating a Foxes vs Rabbits population growth python 3 program:

Welcome to Predator-Prey Model. Enter Initial Rabbit Population: 5891 Enter Initial Fox Population: 16 Enter Number of Years to Simulate: After 99 years there will be 6484 rabbits. After 99 years there wili be 144 foxes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!