我尝试运行我制作的这个程序,但它在扫描字符串文字时一直显示消息“语法错误,EOL
导入随机导入数学
def RoTMG_HP_Function () : initial = 0 for x in range (19) : initial += (random.randint(-5, 5)) return initial
'''打印(RoTMG_HP_Function())'''
def Roll_Simulator(x): x = int(input("enter number of simulations.")) RollsList = [] for i in range (x): RollsList.append(str(RoTMG_HP_Function()))
'''#Miscellaneous code, just test case, not relevant
for i in range (-95,96):
Listcount = 0
for j in range (200):
if int(Rollslist[j]) == i:
Listcount +=1
if Listcount > 0:
print('The roll of ' + str(i) + ' appears ' + str(Listcount) + ' times. ')''''
LifepotExpenditure = 0
for i in range (-19,20):
Listcount = 0
RollsLower = 0
for j in range (x):
if math.floor(int(RollsList[j]) // 5) == i:
Listcount +=1
elif math.floor(int(RollsList[j]) // 5) < i:
RollsLower += 1
if Listcount > 0:
print('Differential of ' + str(i) + ': ' + str(Listcount) + '. The probability of this is ' + str(float(100*Listcount / x)) + '%. The probability of a worse roll is ' + str(float(100*RollsLower / x)) + '%.')
LifepotExpenditure += i*(Listcount)
AverageLifepotExpenditure = float(19.0) - float(LifepotExpenditure / x)
print('\n' + 'On average, you will spend ' + str(AverageLifepotExpenditure) + ' lifepots to max life.')
打印(滚动模拟器(21))
这条线
print('The roll of ' + str(i) + ' appears ' + str(Listcount) + ' times. ')''''
最后多了一个逗号,去掉就行了
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句