这是我当前的代码
#this is the input for population and predators
popOne=float(input("Enter the predator population : ")) 20
popTwo=float(input("Enter the prey population :")) 1000
#period is the amount of iterations, in my case 10
period=float(input("Enter the number of periods: ")) 10
#This is the values for the given periods
A=float(input("Enter the value .1: ")) .1
B=float(input("Enter the value .01 : ")) .01
C=float(input("Enter the value .01 : ")) .01
D=float(input("Enter the value .00002: ")) .00002
#Formluas from my book for prey population, and predator population
prey=(popTwo*(1+A-(B*popOne)))
pred=(popOne*(1-C+(D*popTwo)))
i=0
for i in range(10):
print(prey)
print(pred)
i = i+1
最后一部分是我遇到错误的地方。我无法让代码打印出第一次迭代并继续进行第二次、第三次等等。
另外,我怎样才能使输出看起来像:
After period 1 there are 20 predators
After period 1 there are 900 prey
After period 2 there are 20 predators
After period 2 there are 808 prey
After period 3 there are 20 predators
After period 3 there are 724 prey
等等。