Exercise: Module my_sum
-
Create a file called
my_simple_math.pywith two functions:div(a, b),add(a, b), that will divide and add the two numbers respectively. -
Add another two functions called
test_divandtest_addthat will test the above two functions using assert. -
Add code that will run the tests if someone execute
python my_simple_math.pyrunning the file as if it was a script. -
Create another file called
use_my_simple_math.pythat will use the functions frommy_mathmodule to calculate 2 + 5 * 7 -
Make sure when you run
python use_my_simple_math.pythe 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?