1. Learn
  2. /
  3. Courses
  4. /
  5. Writing Functions in Python

Exercise

Returning functions for a math game

You are building an educational math game where the player enters a math term, and your program returns a function that matches that term. For instance, if the user types "add", your program returns a function that adds two numbers. So far you've only implemented the "add" function. Now you want to include a "subtract" function.

Instructions

100 XP
  • Define the subtract() function. It should take two arguments and return the first argument minus the second argument.