Skip to main content
 首页 » 编程设计

python之我收到语法错误,我不确定为什么

2024年10月01日9cyq1162

<分区>

#population 
 
startOrg = int(input("How many organisms would you like to start with? ")) 
avgDaily = int(input("What rate of increase would you like? Enter a number  
1-100: ")) 
days = int(input("How many days would you like to multiply? ")) 
i = 0 
newOrgs = 0 
day = 0 
newOrgs1 = 0 
avgDaily1 = avgDaily / 100 + 1 
 
print("{0:<10}" "{1:>10}".format("Days", "Population")) 
print("{0:<10}" "{1:>10}".format(day, startOrg) 
 
 
for i in range(days): 
    print("{0:<10}" "{1:>10}".format(day, newOrgs1)) 
    newOrgs1 = avgDaily1 * (newOrgs1 * avgDaily1) 
    day = day + 1 

我不断遇到基于 in range(days) 冒号的语法错误:..

我确信我的数学有很多错误,但我只是想弄清楚这一点。