I'm coding for a project at school (GCSEs) and we have been tasked that the user will enter the value of a population and we have to code a program where python displays a model to show the population after a set number of generations. Once the user has entered their desired values I need to display it in a table-like format that shows the generation number an the population to the respective age range (juvenile, adult, senile). To make the table I used an array but defined it earlier at the beginning of the code. When I try to append the values to the code I get this error ''float' object is not subscriptable'
this is my code of me trying to add to the array:
def run_model():
print ("*"*10, "Running the Model", "*"*10)
time.sleep(2)
for x in range (1, gen_no):
if(x !=0):
juve_values.append ( float(adult_pop[x-1])*birth_rate)
adult_values.append ( float(juve_pop[x-1])*juve_suv)
senile_values.append ( float(sen_pop[x-1])*sen_suv+adult_pop[x-1]*adult_suv)
for y in range (1, gen_no):
print(str(juve_pop[y]) + " "*5 + str(adult_pop[y]) + " "*5 + str(sen_pop[y]))
when you answer please make it as basic as possible as I'm not an advanced coder.
Thanks