From 3c51a1bd1df6b42cd0368d9008c1a5d5775c3127 Mon Sep 17 00:00:00 2001 From: Aron Ahmadia Date: Sat, 12 Oct 2013 01:31:44 -0400 Subject: [PATCH] Added @wltrimbl's suggested fixes from #28 * Removed Unicode debris * Added exception link --- lessons/thw-testing/exercises.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lessons/thw-testing/exercises.ipynb b/lessons/thw-testing/exercises.ipynb index 9d6d854..3ea191e 100644 --- a/lessons/thw-testing/exercises.ipynb +++ b/lessons/thw-testing/exercises.ipynb @@ -25,7 +25,7 @@ "source": [ "## Exercise 1: Mileage\n", "\n", - "The function 'convert_mileage' converts miles per gallon (US style) to\u00c2 liters\n", + "The function 'convert_mileage' converts miles per gallon (US style) to liters\n", "per 100 km (metric style):" ] }, @@ -64,25 +64,25 @@ "\n", "2. Reading the function again, you realize that accepting 0 or negative values\n", "make no sense and should be reported as an error. Look at the exceptions defined\n", - "in the `exceptions` module (use the built-in `help(...)` or `dir(...)`\n", + "in the `exceptions` module (see the [online documentation](http://docs.python.org/2/library/exceptions.html) or use the built-in `help(...)` or `dir(...)`\n", "functions) and decide which of Python's built-in exceptions is most appropriate\n", "to use for invalid input. Create a copy of 'tryexcept.py' called 'raiser.py'\n", "that raises this exception; modify the main body of your program to catch it;\n", "and add a comment inside the file explaining why you chose the exception you\n", "did. (Note: you have to call this file `raiser.py`, not `raise.py` because\n", - "'import raise' is an error. \u00c2 Can you see why?)\n", + "'import raise' is an error. Can you see why?)\n", "\n", "3. [According to Google](http://www.google.ca/search?q=20+miles+per+gallon+in+litres+per+100+km&gbv=1),\n", "20 miles per gallon are equivalent to 11.7607292 liters per 100 km. Use these\n", "values to write a unit test. Keep in mind that these floating values are subject\n", "to truncation and rounding errors. Save the test case in a file called\n", - "`test_mileage.py` and run it using the `nosetests` command. \u00c2 Note:\n", + "`test_mileage.py` and run it using the `nosetests` command. Note:\n", "`test_mileage.py` should use '`from raiser import convert_mileage`' to get the\n", "final version of your mileage conversion function.\n", "\n", "4. Now add a second test case, for 40 miles per gallon equivalent to 5.88036458\n", - "liters per 100 km and run the tests again. \u00c2 Unless you have already fixed the\n", - "error that was present in the initial function, your test should fail. \u00c2 Find\n", + "liters per 100 km and run the tests again. Unless you have already fixed the\n", + "error that was present in the initial function, your test should fail. Find\n", "and fix the error; submit your new function in a file called 'final_mileage.py'. " ] }, -- 2.26.2