python错误修复_关于python:如何修复这个程序中的eol语法错误

我试着运行我制作的这个程序,但它在扫描字符串文字时一直有消息"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())

'''#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)

请复制代码并粘贴到这里

查看此答案stackoverflow.com/a/21089462/3562607。很难从图像中分辨出来(您应该将代码粘贴到代码块中或通过其他方式共享代码块)。扫描代码并确保所有引用都正确。

也许你可以使用pastebin.com,但从你的图片来看,它应该已经被接受了。

这条线

print('The roll of ' + str(i) + ' appears ' + str(Listcount) + ' times. ')''''

结尾还有一个逗号,只需删除它

哦,非常感谢

还有一件事与topic@j.martin无关,在我看来您正在开始一些Python开发。我建议使用其他文本编辑器,如Sublime Text、Atom或Notepad++(稍后谷歌搜索,它们非常有用!)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值