# -*- conding:utf-8 -*- def getJi(x,y,flag): if flag == '+': num = x + y if flag == '-': num = x - y if flag == '*': num = x * y if flag == '/': if y != 0: #判断除数是否为零 num = x / y else: print("除数为零") return (num) f ='N' while f == 'N': x = int(input("请输入第一个数字: ")) y = int(input("请输入第二个数字: ")) flag = input("请输入运算符: ") result = getJi(x,y,flag) print(result) f = input("是否退出程序(Y/N): ") else: print("感谢使用程序!下次再见")