print("Python简易计算器--decorator")
circle=input("请输入一个四则运算式:")
def all(function):
def get():
function()
return get
@all
def start():
if circle.partition("+")[0]!=circle:
infront=circle.partition("+")[0]
behind=circle.partition("+")[2]
print(infront,"+",behind,"=",str(float(infront)+float(behind)))
elif circle.partition("*")[0]!=circle:
infront=circle.partition("*")[0]
behind=circle.partition("*")[2]
print(infront,"*",behind,"=",str(float(infront)*float(behind)))
elif circle.partition("-")[0]!=circle:
infront=circle.partition("-")[0]
behind=circle.partition("-")[2]
print(infront,"-",behind,"=",str(float(infront)-float(behind)))
elif circle.partition("/")[0]!=circle:
infront=circle.partition("/")[0]
behind=circle.partition("/")[2]
if behind=="0":
print("除数不能为零...程序即将报错停止")
assert False
print(infront,"/",behind,"=",str(float(infront)/float(behind)))
start()