Python3,一直输出Too long on line1

B2052 简单计算器

Butter3C3A @ 2023-03-18 00:14:19

代码如下

inputlist=input().split()
if inputlist[-1] == "+" :
    print("{}".format(int(inputlist[0])+int(inputlist[1])))
elif inputlist[-1] == "-" :
    print("{}".format(int(inputlist[0])-int(inputlist[1])))
elif inputlist[-1] == "*" :
    print("{}".format(int(inputlist[0])*int(inputlist[1])))
elif inputlist[-1] == "/" :
    if int(inputlist[1]) == 0 :
        print("Divided by zero!")
    else:
        print("{}".format(int(inputlist[0])/int(inputlist[1])))
else:
    print("Invalid operator!")

Pycharm, 在线Py3编译器,Jupyter notebook全部正确,但是洛谷里面一直显示Too long on line1
在print函数内增加end="\n"或者end=""没用
使用.format方法格式化输出没用
现在不知道怎么办了


by Butter3C3A @ 2023-03-18 00:15:27

?写完这个询问帖,刷新网页后重新提交同样代码之后就没有这种问题了,怎么回事


by AKPC @ 2023-03-18 08:05:42

@Butter3C3A 你谷日爆(大雾


by Jayant_xincheng @ 2023-05-13 09:16:47

(麻烦)(bushi

a,b,c=input().split()
a=int(a)
b=int(b)
if c=="+":
    print(a+b)
elif c=="-":
    print(a-b)
elif c=="*":
    print(a*b)
elif c=="/":
    if b==0:
        print("Divided by zero!")
    else:
        print(a//b)
else:
    print("Invalid operator!")

呵呵


by PLDD @ 2023-08-02 09:34:20

@A_Passing_Creeper 举报了,原来是玩圆神


by AKPC @ 2023-08-02 09:36:07

@PLDD ?


|