S
Shawn Minisall
#Intro
print "*********************************************"
print "WELCOME TO THE POPULATION GROWTH CALCULATOR"
print "*********************************************"
print "This program will predict the size of a population of organisms."
print
print
organisms=input("Please enter the starting number of organisms: ")
increase=input("Please enter the average daily population increase
as a percentage (20% = .20): ")
days=input("Please enter the number of days that they will multiply: ")
print " Day Population"
print "----------------------------------------------------------"
for p in range (days):
population = organisms * population * increase
print days,
print "\t\t\t\t",population
I'm having problems with my for loop here to calculate estimated
population output to a table. Instead of knowing how much I want to
loop it, the loop index is going to be whatever number of days the user
enters. When I run my program, it asks the 3 questions above but then
just dead stops at a prompt which leads me to believe there's something
wrong with my loop. I have the exact same setup in another program, but
the loop index has a specific value. I tried (0,days), (1,days) ect.
and I don't think for loops need accumulators, I've tried it with one
anyways and it still stops.
Any idea's?
thx
print "*********************************************"
print "WELCOME TO THE POPULATION GROWTH CALCULATOR"
print "*********************************************"
print "This program will predict the size of a population of organisms."
organisms=input("Please enter the starting number of organisms: ")
increase=input("Please enter the average daily population increase
as a percentage (20% = .20): ")
days=input("Please enter the number of days that they will multiply: ")
print " Day Population"
print "----------------------------------------------------------"
for p in range (days):
population = organisms * population * increase
print days,
print "\t\t\t\t",population
I'm having problems with my for loop here to calculate estimated
population output to a table. Instead of knowing how much I want to
loop it, the loop index is going to be whatever number of days the user
enters. When I run my program, it asks the 3 questions above but then
just dead stops at a prompt which leads me to believe there's something
wrong with my loop. I have the exact same setup in another program, but
the loop index has a specific value. I tried (0,days), (1,days) ect.
and I don't think for loops need accumulators, I've tried it with one
anyways and it still stops.
Any idea's?
thx