Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Programa que implementa una calculadora con dos numeros
- print("Calculadora básica")
- print("------------------")
- while True:
- print("\nMenu de opciones:")
- print("1. Suma")
- print("2. Resta")
- print("3. Producto")
- print("4. Cociente")
- print("5. Salir")
- opcion = input("Elija su opción: ")
- if opcion == "1":
- a = float(input("Ingrese un numero: "))
- b = float(input("Ingrese otro numero: "))
- print(f"La suma es {a+b}")
- elif opcion == "2":
- a = float(input("Ingrese un numero: "))
- b = float(input("Ingrese otro numero: "))
- print(f"La resta es {a-b}")
- elif opcion == "3":
- a = float(input("Ingrese un numero: "))
- b = float(input("Ingrese otro numero: "))
- print(f"El producto es {a*b}")
- elif opcion == "4":
- a = float(input("Ingrese un numero: "))
- b = float(input("Ingrese otro numero: "))
- print(f"El cociente es {a/b}")
- elif opcion == "5":
- print("Gracias por usar este programa...")
- break
- else:
- print("Opción incorrecta")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement