Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- Ejemplo de una plantilla de menu
- Script que convierte temp de ºC a ºF y viceversa
- """
- print("""
- Conversor de temperaturas
- =========================
- Menu de opciones
- ----------------
- 1. ºC -> ºF
- 2. ºF -> ºC
- ----------------
- """)
- opcion = input("Seleccione una opcion: ")
- if opcion == "1":
- temp = float(input("Ingrese la temperatura: "))
- print(f"{temp:.1f}ºC equivalen a {temp*1.8 + 32:.1f}ºF")
- elif opcion == "2":
- temp = float(input("Ingrese la temperatura: "))
- print(f"{temp:.1f}ºF equivalen a {(temp - 32) / 1.8:.1f}ºC")
- else:
- print("Opción incorrecta")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement