Commit 0f91fca4 authored by muris2016's avatar muris2016
Browse files

Modificado con respecto a calc.py

parent de658c50
...@@ -20,15 +20,12 @@ class Calculadora: ...@@ -20,15 +20,12 @@ class Calculadora:
def do_operation(calc, operation, op1, op2): def do_operation(calc, operation, op1, op2):
try: try:
return calc.operating(calc.operations[operation], op1, op2) return calc.operating(calc.operations[operation], op1, op2)
except KeyError: except KeyError:
sys.exit("Not allowed operation " + operation) sys.exit("Not allowed operation " + operation)
if __name__ == "__main__": if __name__ == "__main__":
op1 = calc.to_number(sys.argv[1]) op1, operation, op2 = calc.take_args()
operation = sys.argv[2]
op2 = calc.to_number(sys.argv[3])
calc = Calculadora() calc = Calculadora()
print(do_operation(calc, operation, op1, op2)) print(do_operation(calc, operation, op1, op2))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment