diff options
-rw-r--r-- | max-client.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/max-client.py b/max-client.py index 488fc6b..1439977 100644 --- a/max-client.py +++ b/max-client.py @@ -93,8 +93,22 @@ if __name__ == "__main__": required=False, help="address of the max computer (defaults to http://localhost:5000)", ) + parser.add_argument( + "--compute", + metavar="OP", + type=str, + choices=("max", "min"), + help="what operation to compute on the numbers? max or min", + ) + parser.add_argument( + "numbers", + metavar="N", + type=int, + nargs="+", + help="numbers for list to query, in order", + ) args = parser.parse_args() client = Client(args.address, log=True) - assert 3 == client.compute([1, 2, 3, 1], op="max") - assert 1 == client.compute([1, 2, 3, 1], op="min") + answer = client.compute(args.numbers, op=args.compute) + print(answer) |