Ad
Code
Diff
  • def Calculator(expression):
        try:
            return eval(expression)
        except:
            return 0
    
    • def Calculator(operator: str = "+", arg1: float = 0, arg2: float = 0):
    • def Calculator(expression):
    • try:
    • return eval(f"{arg1} {operator} {arg2}")
    • return eval(expression)
    • except: