# Lotka-Volterra equations # Subroutine to simulate predator/prey relationship def LV(Prey, Predators, A, B, C, D, E, G): Generation = 0 while Generation < G and Prey > 1 and Predators > 1: Generation = Generation + 1 PreyGrowth = E ** (A - (C * Predators)) Prey = Prey * PreyGrowth PredatorGrowth = E ** (( D * C * Prey) - B) Predators = Predators * PredatorGrowth print("Generation: {} | Prey: {:.0f} | Predators: {:.0f}".format(Generation, Prey, Predators)) # Main program Prey = 30 Predators = 5 A = 0.8 B = 0.5 C = 0.1 D = 0.3 E = 2.718 G = 10 LV(Prey,Predators,A,B,C,D,E,G)