dict = {'+': add(part1, part3), '-': sub(part1, part3), '*': mult(part1,
    part3), '/': div(part1, part3)}
try:
    dict[op]
except KeyError:
    pass
Using a dictionary as a switch statement in Python