Can someone help me with this code? I am using Python 3 and this is a beginner level course.
Statistics Canada projects population based on the following assumptions:
- One birth every 78 seconds
- One death every 105 seconds
- One new immigrant every 147 seconds
My assignment:
- Write a program to display the population for each of the next ten years (i.e. 1 to 10 years from now). Assume the current population is 38,233,484 and one year has 365 days.
- Now rewrite the program to prompt the user to enter the number of years and displays the population after that many years. Your program will not accept a negative number.
All I could figure out till now is this:
mylist= [1,2,3,4,5,6,7,8,9,10]
for x in mylist:
print("Year", x, "has a population of",r)
def population(b, d, i):
p=(b+i-d)
return p
a=(1/78)
b=(1/105)
c=(1/147)
r=population (a,b,c)
inregrations
FirebaseRun a cloud function that will run let's say every 78 seconds, one that runs every 105 and another that runs every 147 seconds that will increment/decrement total population count, respectively.
PHP/LaravelSame as firebase, but with a CronJob.
pythonThis is a bit tricky because cloud functions are really hard to setup with python, so you will have to deal with a python cloud function, or pull the population count in the client-side and run an interval that will increment/decrement the population count.
TL;DR
Use firebase with cloud functions.