Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- 3) Ingresar una temp y convertirla. El script debe pasar de ºC -> ºF y viceversa. Test: 10ºC = 50ºF
- """
- menu = """
- Menu de opciones:
- -----------------
- 1. ºC --> ºF
- 2. ºF --> ºC
- 3. Salir
- -----------------
- """
- while True:
- print(menu)
- opcion = input("Seleccione una opción: ")
- if opcion == "1":
- temp = float(input("Ingrese la temperatura: "))
- temp = temp * 1.8 + 32
- print(f"Temperatura: {temp:.1f}ºF")
- elif opcion == "2":
- temp = float(input("Ingrese la temperatura: "))
- temp = (temp - 32) / 1.8
- print(f"Temperatura: {temp:.1f}ºC")
- elif opcion == "3":
- print("Gracias por utilizar este programa")
- break
- else:
- print("Opción equivocada")
Advertisement
Add Comment
Please, Sign In to add comment