Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def suma(a, b): return a + b
- def resta(a, b): return a - b
- def multiplica(a, b): return a * b
- def divide(a, b): return a / b
- def sale(): print("ADIOS!")
- print("Cuatro operaciones")
- print("1. Sumar")
- print("2. Restar")
- print("3. Multiplicar")
- print("4. Dividir")
- print("5. Salir")
- print("Ingrese el primer valor: ")
- a = int(input())
- print("Ingrese el segundo valor: ")
- b = int(input())
- print("Los valores ingresados son: " + str(a) + " y " + str(b))
- opcion = 0
- while(opcion != 5):
- print("Por favor ingrese opción: ")
- opcion = int(input())
- print("Opción ingresada : " + str(opcion))
- if(opcion == 1): print("la suma es: ", suma(a,b))
- elif(opcion == 2): print("la resta es: ", resta(a,b))
- elif(opcion == 3): print("la multiplicación es: ", multiplica(a,b))
- elif(opcion == 4): print("la división es: ", divide(a,b))
- elif(opcion == 5): sale()
- else: print("Opción inválida")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement