1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Programming Paradigms

Exercise

Correct an "impure" function

While helping your coworker with their data processing task, you couldn't help but notice that some of the functions they have written are actually not pure functions. Oops! It seems like maybe they almost grasped the concept, but not quite yet. Now you're going to have to help them by making a couple of corrections to what they've written.

Instructions 1/2

undefined XP
    1
    2
  • First things first, your coworker's function is referencing variables that are defined outside of the function and not being passed in; modify the parameter list of the function to include any variable names not defined within the function.