Advertisement
teslariu

temp

Jan 7th, 2022
2,591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. """
  5. Script que pide una temperatura y la convierte
  6. """
  7. print("******Conversión de temperaturas********")
  8. print("""
  9. Menu de opciones:
  10. ---------------------
  11.     1. ºC a ºF
  12.     2. ºF a ºC
  13. ---------------------
  14. """)
  15.  
  16. opcion = input("Seleccione una opción: ")
  17.  
  18. if opcion == "1":
  19.     temp = float(input("Ingrese la temperatura en ºC: "))
  20.     print(f"La temperatura equivale a {temp*1.8+32}ºF")
  21.  
  22. elif opcion == "2":
  23.     temp = float(input("Ingrese la temperatura en ºF: "))
  24.     print(f"La temperatura equivale a {(temp-32) / 1.8}ºC")
  25.    
  26. else:
  27.     print("Opción incorrecta...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement