澪风泠华 2022-08-26 22:11 采纳率: 0%
浏览 19
已结题

求帮我把代码改成可以运行并告诉我错误的点

def encounter(stest,ytest):
red = []
Stests = []
Ytests = []
for line in stest.splitlines():
if not line.isspace() and line != "":
Stests.append(line)

for line in ytest.splitlines():
    if not line.isspace() and line != "":
        Ytests.append(line)

smax = len(Stests)
ymax = len(Ytests)
for step in range(max(smax,ymax)):
    try:
        sworld = Stests[step].split
    except:
        sworld.append("")

    try:
        yworld = Ytests[step].split
    except:
        yworld.append("")
if sworld != yworld:
    red.append((step),sworld[step],yworld[step])
    print(red)

encounter("red demons dragon","star dust dragon")

  • 写回答

2条回答 默认 最新

  • 烟雨龙升 2022-08-26 22:26
    关注

    split() 这个后面的括号没了
    还有最后面red.append方法没这样写的吧

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月27日
  • 创建了问题 8月26日