使用字典查找和递归的基本计算器

请向我解释

I want to know how the calculate function works.

from operator import pow, truediv, mul, add, sub  

operators = {
    '+': add,
    '-': sub,
    '*': mul,
    '/': truediv
}

def calculate(s):
    if s.isdigit():
        return float(s)
    for c in operators.keys():
        left, operator, right = s.partition(c)
        if operator in operators:
            return operators[operator](calculate(left), calculate(right))

calc = input("Type calculation:\n")
print("Answer: " + str(calculate(calc)))