Skip to content

Commit

Permalink
Use doctest to spot errors in examples UCL-RITS#100
Browse files Browse the repository at this point in the history
  • Loading branch information
liamchalcroft committed Nov 19, 2020
1 parent 9ed24ad commit 8dacc4b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions week06/average-squares-example/average_squares/squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = []
Expand Down

0 comments on commit 8dacc4b

Please sign in to comment.