zhaojiaming2 @ 2024-10-24 12:45:02
x,y,z=input().split;
x=int(x);y=int(y);z=str(z)
if (z=='+'):
print(x+y)
elif (z=='-'):
print(x-y)
elif (z=='*'):
print(x*y)
elif (z=='/'):
if (y==0):
print("Divided by zero!")
else :
print(x//y);
else:
print("Invalid operator!")
by LionBlaze @ 2024-10-24 12:48:49
@zhaojiaming2 x,y,z=input().split;
是个什么东东
by LionBlaze @ 2024-10-24 12:49:14
@zhaojiaming2 你不会是从 C/C++ 转到 Python 的吧
by __int1024 @ 2024-10-24 12:51:59
@zhaojiaming2 第一行改为:
x,y,z=input().split(' ')
by _None @ 2024-10-24 12:52:04
@zhaojiaming2 语法错误 正确代码:
x=input().split(" ")
z=str(x[2]);y=int(x[1]);x=int(x[0]);
if (z=='+'):
print(x+y)
elif (z=='-'):
print(x-y)
elif (z=='*'):
print(x*y)
elif (z=='/'):
if (y==0):
print("Divided by zero!")
else :
print(x//y);
else:
print("Invalid operator!")