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

Exercise

Modifying variables outside local scope

Sometimes your functions will need to modify a variable that is outside of the local scope of that function. While it's generally not best practice to do so, it's still good to know how in case you need to do it. Update these functions so they can modify variables that would usually be outside of their scope.

Instructions 1/3

undefined XP
  • 1

    Add a keyword that lets us update call_count from inside the function.

  • 2

    Add a keyword that lets us modify file_contents from inside save_contents().

  • 3

    Add a keyword to done in check_is_done() so that wait_until_done() eventually stops looping.