Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Script que convierte temperaturas de ºC a ºF o viceversa
- # test: 10ºC equivalen a 50ºF
- print("---------------------------")
- print("Conversión de temperaturas *")
- print("---------------------------")
- while True:
- print("\nMenu de opciones:")
- print("-------------------")
- print(" 1. ºC a ºF")
- print(" 2. ºF a ºC")
- print(" 3. Salir")
- print("-------------------")
- opcion = input("Seleccione una opción: ")
- if opcion == "1":
- temp = int(input("Ingrese la temperatura en ºC: "))
- print(f"Temperatura: {temp*1.8 + 32}ºF")
- elif opcion == "2":
- temp = int(input("Ingrese la temperatura en ºF: "))
- print(f"Temperatura: {(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