Editor

Simple Math

Python Basics · Beginner · 25 XP · about 2 min

Write a function called add(a, b) that takes two numbers and returns their sum.

Example

add(2, 3)   # Returns 5
add(-1, 1)  # Returns 0
add(0, 0)   # Returns 0

Requirements

  • The function should accept two parameters
  • Return the sum of the two numbers
def add(a, b):
# Your code here
pass
# Test your function
print(add(2, 3))

Ready?

Accept the challenge to start writing. A small timer counts the time this page is in view.

Output appears here.