From c792c647eced97e214c51a71c53b8cd1cf3de177 Mon Sep 17 00:00:00 2001 From: sahas111 Date: Thu, 5 Mar 2015 16:10:02 +1100 Subject: [PATCH] Revert "changed" --- calc.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 calc.py diff --git a/calc.py b/calc.py deleted file mode 100644 index adea0f0..0000000 --- a/calc.py +++ /dev/null @@ -1,38 +0,0 @@ -""""calc.py: A simple Python calculator changed.""" - -import sys - -def add_all(nums): - return sum(nums) - -def multiply_all(nums): - return reduce(lambda a, b: a * b, nums) - - -def divide_all(nums): - return reduce(lambda a, b: a / b, nums) - -def diff_all(nums): - return reduce(lambda a, b: a - b, nums) - - -if __name__ == '__main__': - command = sys.argv[1] - nums = map(float, sys.argv[2:]) - if command == 'add': - print(add_all(nums)) - elif command == 'subtract': - print(diff_all(nums)) - elif command == 'multiply': - print(multiply_all(nums)) - elif command == 'divide': - print(divide_all(nums)) - elif command == 'min': - print(min(nums)) - elif command == 'max': - print(max(nums)) - elif command == 'int': - print(int(nums)) - else: - usage = "calc.py [add|multiply|min][max] NUM1 [NUM2 [NUM3 [...]]]" - print(usage)