Calculator

print ("---Calculadora---") #RexProgramador author, Licencia GLP print "1- Sumar" print "2- Restar" print "3- Multiplicar" print "4- Dividir" print "5- Salir" print "Author RexProgramador" op = int(raw_input('Opcion: ')) if op == 1: print "---Sumar---" valor_1 = int(raw_input('')) print " + " valor_2 = int(raw_input('')) suma = valor_1 + valor_2 print "El resultado es: %d" % suma elif op == 2: print "---Restar---" valor_1 = int(raw_input('')) print " - " valor_2 = int(raw_input('')) resta = valor_1 - valor_2 print "El resultado es: %d" % resta elif op == 3: print "---Multiplicar---" valor_1 = int(raw_input('')) print " x " valor_2 = int(raw_input('')) multiplicacion = valor_1 * valor_2 print "El resultado es: %d" % multiplicacion elif op == 4: print "---Dividir---" valor_1 = int(raw_input('')) print " / " valor_2 = int(raw_input('')) Dividir = valor_1 / valor_2 print "El resultado es: %d" % Dividir

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.