Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def average_of_squares(list_of_numbers, list_of_weights=None):
""" Return the weighted average of a list of values.
""" Return the weighted average of squares of a list of values.

By default, all values are equally weighted, but this can be changed
by the list_of_weights argument.
Expand All @@ -29,7 +29,7 @@ def average_of_squares(list_of_numbers, list_of_weights=None):
for number, weight
in zip(list_of_numbers, effective_weights)
]
return sum(squares)
return sum(squares)/len(squares)


def convert_numbers(list_of_strings):
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