Generation

generate functionSat, 03 Dec 2022

A function that can solve high level maths problem

def calculate(a, b, operator): if operator == "add": return a + b elif operator == "subtract": return a - b elif operator == "multiply": return a * b elif operator == "divide": return a / b else: return "unknown" calculate(1, 2, "add")

Questions about programming?Chat with your personal AI assistant