Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In python Based on this data, write a program that displays a chart predicting t

ID: 3669434 • Letter: I

Question

In python

Based on this data, write a program that displays a chart predicting the population for a specified number of years.

One birth every 8 seconds
One death every 11 seconds
One immigrant every 30 seconds

Consider

If there is one birth every 8 seconds, how many births/year are there? Do these calculations in your program. Do the same for deaths and immigrants. With these values, you can then calculate the net change in population in a year. Assume that every year has 365 days.

No partial people are allowed – display your result to whole number

Do not use tabs ( ) to separate columns.

Input validation is required.

Explanation / Answer

#Here , I have taken an assumption that the initial population is : 20000000

import sys
import matplotlib.pyplot as plt

year = int(sys.argv[1])

total_birth = 365*24*60*60/8
total_death = 365*24*60*60/11
total_immigrants = 365*24*60*60/30

print "total births in a year:",total_birth
print "total death in a year:",total_death
print "total imigrants in a year:",total_immigrants

increase = total_birth+total_immigrants-total_death
print "net increase in population in year:", increase

initial = 20000000
x = [i for i in range (1,year+1)]
y = [initial+increase*(i-1) for i in range (1,year+1)]
plt.plot(x,y)
plt.show()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote