SHARE
TWEET

ALT3(AOE)NEWZEALAND

a guest Nov 20th, 2019 105 in 341 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. years=[]
  2. startPop=3858#This is the population in thousands.
  3. population=[startPop]
  4. birthRate=[14.480, 14.332, 14.183, 14.338, 14.484, 14.635, 14.785, 14.936, 14.689, 14.442, 14.195, 13.948, 13.701, 13.488, 13.275, 13.061, 12.848, 12.635, 12.549]
  5. deathRate=[7.220, 7.156, 7.091, 7.039, 6.988, 6.936, 6.885, 6.833, 6.839, 6.845, 6.852, 6.858, 6.864, 6.888, 6.912, 6.936, 6.960, 6.984, 7.033]
  6. migrationRate=[4.946, 5.841, 6.736, 5.976, 5.216, 4.455, 3.695, 2.935, 3.157, 3.380, 3.602, 3.825, 4.047, 3.868, 3.690, 3.511, 3.333, 3.154, 3.028]
  7. popData=[]
  8. year=2000
  9. for i in range(19):
  10.     population.append(population[i]-(population[i]*(deathRate[i]/1000))+(population[i]*(birthRate[i]/1000))+(population[i]*(migrationRate[i]/1000)))#This is calculating the due population for the next year by adding birth rates and subtracting death and migration rates.
  11.     population2=population[i]*1000#This is turning the populations from being in thousands to being in normal numbers.
  12.     population2=round(population2)#This is rounding the populations to awhole number.
  13.     popData.append(population2)
  14.     years.append(year)
  15.     print('In', year, 'the population was: ', population2)
  16.     year=year+1
  17.     import plotly
  18. from plotly.graph_objs import *#This is importing code to create a web page to display the data.
  19. plotly.offline.plot({
  20.     "data": [Scatter( y=popData, x=years)],
  21.     "layout": Layout(title="New Zealand population 2000-2019:")
  22. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top