📜  获取运算符作为python代码示例中的输入

📅  最后修改于: 2022-03-11 14:45:28.590000             🧑  作者: Mango

代码示例3
def operation(number1, number2, operator):
    if operator == '+':
        return number1 + number2
    elif operator == '-':
        return number1 - number2