Writing Functions
A function packages steps behind a name. Use def, list the inputs, and return the result.
Example
def double(n):
return n * 2
print(double(4))
Your task
Write add(a, b) that returns the sum and print add(2, 3).
Python Foundations
A function packages steps behind a name. Use def, list the inputs, and return the result.
def double(n):
return n * 2
print(double(4))
Write add(a, b) that returns the sum and print add(2, 3).
This lesson is checked against the lesson rules. Your code is never run on our servers.