Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Answers #140
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Nov 27, 2020
1 parent 9ed24ad commit 33ecba5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions week06/average-squares-example/average_squares/squares.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Computation of weighted average of squares."""

from argparse import ArgumentParser

def average_of_squares(list_of_numbers, list_of_weights=None):
""" Return the weighted average of a list of values.
Expand Down Expand Up @@ -51,12 +51,12 @@ def convert_numbers(list_of_strings):


if __name__ == "__main__":
numbers_strings = ["1","2","4"]
weight_strings = ["1","1","1"]

numbers = convert_numbers(numbers_strings)
weights = convert_numbers(weight_strings)
result = average_of_squares(numbers, weights)
print(result)
parser = ArgumentParser(description="Mean of squared numbers")
parser.add_argument("numbers", nargs='+', help="the list of numbers")
arguments = parser.parse_args()

numbers = convert_numbers(arguments.numbers)

result = average_of_squares(numbers)

print(result)

0 comments on commit 33ecba5

Please sign in to comment.