Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- Script que pide una temp en ºF y la convierte en ºC y viceversa
- Ej:
- >>> Programa de conversión de temperaturas
- >>> Menu de opciones:
- ----------------
- 1. ºC -> ºF
- 2. ºF -> ºC
- 3. Salir
- """
- print("Programa de conversión de temperaturas")
- while True:
- print("""
- Menu de opciones:
- ----------------
- 1. ºC -> ºF
- 2. ºF -> ºC
- 3. Salir
- """)
- opcion = input("Seleccione una opción: ")
- if opcion == "1":
- temp = float(input("Ingrese el valor de la temperatura: "))
- print(f"El valor de la temperatura es {temp*1.8 + 32}ºF")
- elif opcion == "2":
- temp = float(input("Ingrese el valor de la temperatura: "))
- print(f"El valor de la temperatura es {(temp - 32) / 1.8}ºC")
- elif opcion == "3":
- print("Gracias por usar este programa...")
- break
- else:
- print("Opción incorrecta...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement