How do I fix the EOL Syntax error in this programm
我试着运行我制作的这个程序,但它在扫描字符串文字时一直有消息"syntaxerror,eol"
随机进口导入数学
def rotmg_hp_函数():初始=0对于范围(19)中的x:初始值+=(random.randint(-5,5))返回初始值
''print(rotmg_hp_function())''
Def Roll_模拟器(X):x=int(输入("输入模拟次数"))RoSsList=对于范围(x)内的i:rollslist.append(str(rotmg_hp_function())
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | '''#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(' ' + 'On average, you will spend ' + str(AverageLifepotExpenditure) + ' lifepots to max life.') |
打印(滚动模拟器(21)
这条线
1 | print('The roll of ' + str(i) + ' appears ' + str(Listcount) + ' times. ')'''' |
结尾还有一个逗号,只需删除它