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

Commit

Permalink
Answers #141 - Now includes weights as an optional input
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Nov 27, 2020
1 parent de72bd1 commit 51072b3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions week06/average-squares-example/average_squares/squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ def convert_numbers(list_of_strings):


if __name__ == "__main__":
parser = ArgumentParser(description="Mean of squared numbers")
parser = ArgumentParser(description="Weighted mean of squared numbers")
parser.add_argument("numbers", nargs='+', type=float, help="the list of numbers")
parser.add_argument("--weights", "-w", nargs='+', type=float, help="the list of weights")
arguments = parser.parse_args()

result = average_of_squares(arguments.numbers)
result = average_of_squares(arguments.numbers, arguments.weights)

print(result)

0 comments on commit 51072b3

Please sign in to comment.