teslariu

while true

Jan 12th, 2022
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 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.  
  9. while True:
  10.        
  11.     print("""
  12.     Menu de opciones:
  13.     ---------------------
  14.         1. ºC a ºF
  15.         2. ºF a ºC
  16.         3. Salir
  17.     ---------------------
  18.     """)
  19.  
  20.     opcion = input("Seleccione una opción: ")
  21.  
  22.     if opcion == "1":
  23.         temp = float(input("Ingrese la temperatura en ºC: "))
  24.         print(f"La temperatura equivale a {temp*1.8+32}ºF")
  25.  
  26.     elif opcion == "2":
  27.         temp = float(input("Ingrese la temperatura en ºF: "))
  28.         print(f"La temperatura equivale a {(temp-32) / 1.8}ºC")
  29.        
  30.     elif opcion == "3":
  31.         print("Gracias por utilizar este programa...")
  32.         break
  33.    
  34.     else:
  35.         print("Opción incorrecta...")
Advertisement
Add Comment
Please, Sign In to add comment