Advertisement
teslariu

menus

Apr 24th, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. Programa que convierte de ºC -> ºF o de ºF -> ºC
  5.  
  6. Conversion
  7. ºF = 1.8 * ºC + 32  
  8. ºC = (ºF - 32) / 1.8
  9.  
  10. 10ºC equivalen a 50ºF
  11. """
  12. print("Menu de opciones:")
  13. print("-----------------")
  14. print("1. Convertir de ºC a ºF")
  15. print("2. Convertir de ºF a ºC")
  16.  
  17. opcion = input("Ingrese su opcion: ")
  18. temperatura = float(input("Ingrese la temperatura: "))
  19.  
  20. if opcion == "1":
  21.     temperatura = 1.8 * temperatura + 32
  22.     print(f"Temperatura: {temperatura}ºF")
  23.  
  24. elif opcion == "2":
  25.     temperatura = (temperatura - 32) / 1.8
  26.     print(f"Temperatura: {temperatura}ºC")
  27.    
  28. else:
  29.     print("Opción incorrecta")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement