Skip to content

Commit b80be9a

Browse files
authored
Update arith.py
update to reflect changes to the arithmetic commandline application
1 parent 305b05d commit b80be9a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

code/arith.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ def main():
55
assert len(sys.argv) == 4, 'Need exactly 3 arguments'
66

77
operator = sys.argv[1]
8-
assert operator in ['add', 'subtract', 'multiply', 'divide'], (
9-
'Operator is not one of add, subtract, multiply, or divide: '
8+
assert operator in ['--add', '--subtract', '--multiply', '--divide'], (
9+
'Operator is not one of --add, --subtract, --multiply, or --divide: '
1010
'bailing out')
1111
try:
1212
operand1, operand2 = float(sys.argv[2]), float(sys.argv[3])
@@ -19,13 +19,13 @@ def main():
1919

2020
def do_arithmetic(operand1, operator, operand2):
2121

22-
if operator == 'add':
22+
if operator == '--add':
2323
value = operand1 + operand2
24-
elif operator == 'subtract':
24+
elif operator == '--subtract':
2525
value = operand1 - operand2
26-
elif operator == 'multiply':
26+
elif operator == '--multiply':
2727
value = operand1 * operand2
28-
elif operator == 'divide':
28+
elif operator == '--divide':
2929
value = operand1 / operand2
3030
print(value)
3131

0 commit comments

Comments
 (0)