Transcript

the following content is provided under a Creative Commons license your support will help MIT open courseware continue to offer highquality educational resources for free to make a donation or view additional materials from hundreds of MIT courses visit MIT opencare at ocw.mit.edu let's look at this exercise all right so we have this function is even same one as before except now I'm giving you this implementation if n is positive and N um has a remain n divided by two's remainder is zero return true so if n is even and positive return true the next one if n is negative and divisible by two return true okay so far and otherwise return false question being with that implementation is this test set and is for and is minus four path complete and the answer is yes because four is an even number is is a positive number and divisible by two minus 4 is an even number is a sorry minus four is a negative number and divisible by two and five would hit upon the else so the answer is actually yes for that first question perfect second question without implementation which value for n is is incorrectly labeled by that program and well n is very large still works n is very small still works and remember I said you have to test boundary conditions in this case boundary conditions for this program being when n is equal to zero so I think the orange is and is equal to zero perfect