CSCA08H3 Lecture 9: Week 9 Notes
Document Summary
So the number is not divided by zero because python rst checks if the number is equal to zero or not. We now get another error, though because 4 is divisible by -2 and it should have been included in the example return. So when we change the returned value to the second example case to [-2, 2], and run a doctest, we get no failures. We can also include the code to the right in the module we are creating. This way, when we run the module, the test cases are automatically executed. If they all pass, there is no output in the shell so we know it"s the functions are working. Recall our two palindrome functions we tested. Now let"s say we have two modules with different approaches to calculating palindromes. The rst module contains an input request for a word.