本文共 374 字,大约阅读时间需要 1 分钟。
a,b,c=input('输入的a,b,c用空格间隔开').split()#a b 为数 c 为操作数a1=int(a)b1=int(b)if((c=='+')|(c=='-')|(c=='*')|(c=='/')): if c =='+': print(a1+b1) elif c=='-': print(a1-b1) elif c=='*': print(a1*b1) else: if b1==0: print('Divided by zero') else: print(a1/b1)else: print("Invalid operator")
转载地址:http://xxmen.baihongyu.com/