0

I have this code that I'm trying to run in SublimeREPL, but after it takes both inputs, it skips the code where it says what to do with those numbers, and it jumps to the final lines. Has the version of python something to do with it?

ef suma(num1, num2):
    return num1+num2

def resta(num1, num2):
    return num1-num2

def multiplica(num1, num2):
    return num1*num2

def divide(num1,num2):  
    return num1/num2

op1=(int(input("Introduce el primer número: ")))

op2=(int(input("Introduce el segundo número: ")))  
 
operacion=input("Introduce la operación a realizar (suma,resta,multiplica,divide): ")

if operacion=="suma":
    print(suma(op1,op2))

elif operacion=="resta":
    print(resta(op1,op2))

elif operacion=="multiplica":
    print(multiplica(op1,op2))

elif operacion=="divide":
    print(divide(op1,op2))

else:
    print ("Operación no contemplada")


print("Operación ejecutada. Continuación de ejecúción del programa ")
OdatNurd
  • 21,371
  • 3
  • 50
  • 68

1 Answers1

0

Found it!

I created a new build system with python3 and removed the quotation marks, so:

if operacion==suma:
    print(suma(op1,op2))
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • Are you using Python 2? This shouldn't work in Python 3. What is the output of `import sys; print(sys.version)`? – MattDMo Aug 28 '20 at 13:01