Example:
def add(a, b):
return a + b
Call the function with arguments:
result = add(3, 5)
print(result) # Outputs 8
Functions can return values using the return
statement. This lets you store the output or use it later.
Example:
def multiply(x, y):
return x * y
product = multiply(4, 6)
print(product) # Outputs 24