Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me with the code for this type of problem? Use your text editor to create a .py file containing a Python program

Can someone help me with the code for this type of problem?

image text in transcribed

Use your text editor to create a .py file containing a Python program that simulates the zombie epidemic through the year 2029. Each line of your program's output should show the year, the number of zombies in that year, and the number of humans remaining in that year. Separate these three values with commas on each line.

For example, the first 4 lines that your program prints should look exactly like this:

2001,10,535753 2002,53584.3,482178.7 2003,96443.74,439319.26 2004,130731.29200000002,405031.708

The last line that your program prints should look like this:

2029,267363.3611636978,268399.6388363022

Notice that there are no extra spaces in between the numbers on each line. They are separated only by commas.

Your program should print out one line for each year from 2001 through 2029. Therefore, it should print out 29 lines... no more, no less.

Your assignment is to simulate the progression of a zombie epidemic as it spreads through Portland, Oregon, beginning in the year 2001 (which was about the time that zombies became unnervingly popular e ). This assignment will test whether you can use loops when translating from a problem to a computational solution (CLO1). Portland's population in 2001 was 535,753. Suppose that 10 zombies wandered in from the forests of Cascadia and started biting people, turning them into zombies. Set n_humans = 535753 and n_zombies = 10 in 2001. Each year, let's suppose that (n_humans - n_zombies)*0.1 additional people get bitten and turned into zombies. (In other words, 10% of the non-zombies get zombified each year.) So in 2002, n_bitten = (n_humans - n_zombies)*0.1 = 53574.3 (you don't need to round) The number of humans goes down, and n_humans = previous n_humans - n_bitten = 535753 - 53574.3 = 482178.7 humans in 2002. And the number of zombies goes up, so n_zombies = previous n_zombies + n_bitten = 10 + 53574.3 = 53584.3 zombies in 2002

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

More Books

Students also viewed these Databases questions