实现一个有效的简单计算器,可以处理加减乘除和括号运算,并且支持空格字符的输入。

简单计算器实现

# 示例
expression = "(2+3) * 5 - 6 / 2"
result = calculate(expression)
print(result)  # 输出:22.0