CSC120H Fall 2018: Exercises

CSC120: Exercise 6

Due: Sunday, December 2nd by 11:00pm

What to hand in

Submit one file, which must be named "e6.py" (without the quotation marks). Exercises are to be done individually.

Check that file name!

Once you have submitted on MarkUs, be sure to check that you have submitted the correct versions; new or missing files will not be accepted after the due date. Spelling of filenames, including case, counts. If your file is not named exactly as required, your mark will be zero.

If you realize you have submitted an incorrectly named file, just fix the name and resubmit. There is no need to get rid of the wrongly-named file.

Watch that clock!

We will mark the newest version submitted not later than the deadline. Don't submit just once; instead, submit at least once well in advance, so that you know what you're doing, and then keep submitting new versions as you do more of the exercise. That way, if you run out of time on the last function that you just can't do, you'll still get marks for the others.

IMPORTANT NOTE: Make sure your e6.py file does not create any errors when you run it (when you press the green play button in Wing).
If any errors occur when running the file, you will get zero.

What to put in e6.py

Please read through the contents of the starter file e6_starter.py. Download this file and rename it to e6.py. In this file, we have provided both the function header and the docstring for all the functions that you need to have in the file e6.py.

You need to write the function body for each of these three functions. Simply add your code below each comment that says # Add your code here.

The docstring examples provided rely on the provided e6_database.db file which has a Books Table. The Books table has a book_id TEXT column, a title TEXT column, and an author TEXT column.

Example Test Cases

The docstrings contain examples that demonstrate how your function should work when called. Do not just check the example test cases, but test the functions with test cases of your own too.

Important Instructions!

Remember, you are only submitting the function definitions. You do not need to submit any test cases or Python Shell output.

Like the name of the file itself, the names of the functions must be spelled exactly as shown. You should not change them.

Do not call print in your functions, and do not write any code outside of the function definitions. Doing so may cause your code to fail the tests.

How to check your code

You will make mistakes! Be sure to check your functions by calling them in the Shell. Write some test cases (like we did in class and lab), and make sure your function works with different arguments. Ensure you get back what you expect when you call your functions. Create your own example test cases and ensure you get the expected results.

If you need help

Please make use of any of the resources listed here: Getting Help

Autotesting

We will be autotesting your code for correctness after the submission deadline. An announcement will be made once autotesting results are available.