Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
253 B
1
Indexable
Never
def calculate(expression):
  # Simple implementation for basic arithmetic
  try:
    result = eval(expression)
    return result
  except:
    return "Invalid expression"

expression = "2 + 3 * 4"
result = calculate(expression)
print(result)
Leave a Comment