From 8dacc4b945b70f491b9b4e100f18a0529c137a09 Mon Sep 17 00:00:00 2001 From: Liam Chalcroft Date: Thu, 19 Nov 2020 10:57:38 +0000 Subject: [PATCH] Use doctest to spot errors in examples UCL-RITS#100 --- week06/average-squares-example/average_squares/squares.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/week06/average-squares-example/average_squares/squares.py b/week06/average-squares-example/average_squares/squares.py index d7e454e..4dbb9f2 100644 --- a/week06/average-squares-example/average_squares/squares.py +++ b/week06/average-squares-example/average_squares/squares.py @@ -10,9 +10,9 @@ def average_of_squares(list_of_numbers, list_of_weights=None): Example: -------- >>> average_of_squares([1, 2, 4]) - 7.0 + 21 >>> average_of_squares([2, 4], [1, 0.5]) - 6.0 + 12.0 >>> average_of_squares([1, 2, 4], [1, 0.5]) Traceback (most recent call last): AssertionError: weights and numbers must have same length @@ -38,7 +38,7 @@ def convert_numbers(list_of_strings): Example: -------- >>> convert_numbers(["4", " 8 ", "15 16", " 23 42 "]) - [4, 8, 15, 16] + [4.0, 8.0, 15.0, 16.0, 23.0, 42.0] """ all_numbers = []