Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- Script que implementa un template para ejcución de un programa
- ininterrumpidamente
- while True:
- programa
- salir con break
- """
- # Hacer un script que pida una temperatura en ºC y la pase a ºF o viceversa
- # 10ºC = 50ºF
- while True:
- print("""
- Menú de opciones
- ----------------
- 1. ºC -> ºF
- 2. ºF -> ºC
- 3. Salir
- """)
- opcion = input("Seleccione una opción: ")
- if opcion == "1":
- t = float(input("Ingrese la temperatura: "))
- print(f"{t}ºC equivalen a {t*1.8 + 32:.1f}ºF")
- elif opcion == "2":
- t = float(input("Ingrese la temperatura: "))
- print(f"{t}ºF equivalen a {(t - 32) / 1.8:.1f}ºC")
- elif opcion == "3":
- print("Gracias por usar este programa...")
- break
- else:
- print("Error, opción incorrecta")
Advertisement
Add Comment
Please, Sign In to add comment