Exercise: Module my_sum


  • Create a file called my_simple_math.py with two functions: div(a, b), add(a, b), that will divide and add the two numbers respectively.
  • Add another two functions called test_div and test_add that will test the above two functions using assert.
  • Add code that will run the tests if someone execute python my_simple_math.py running the file as if it was a script.
  • Create another file called use_my_simple_math.py that will use the functions from my_math module to calculate 2 + 5 * 7
  • Make sure when you run python use_my_simple_math.py the tests won't run.
  • Add documentation to the "add" and "div" functions to examples that can be used with doctest.
  • Can you run the tests when the file is loaded as a module?