I am trying to run this code but Jupyter keeps giving me the following syntax error at the else condition.
File "<ipython-input-24-beb6bcd9d77b", line 24 else: ^ SyntaxError: invalid syntax
I was running a similar code earlier and else worked there but I don't understand what's wrong with this code.
valid = True
while valid:
if predators != 0 and prey != 0:
preyCount.append(prey)
predatorCount.append(predators)
prey = prey * (1 + preyGrowth - predationRate * predators)
predators = predators * (1 - predShrink + predFedBirthRate * preyCount[-1]
else:
valid = False
Aucun commentaire:
Enregistrer un commentaire