teslariu

paquete

Nov 16th, 2022
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # bosquejo de un paquete
  5. """Programa que calcula el cubo de un nro"""
  6.  
  7. __author__ = "Ale"
  8. __copyright__ = "Python Programming"
  9. __credits__ = ["Pepe","Ana","Juana"]
  10. __license__ = "GPL"
  11. __version__ = "3.0"
  12. __email__ = "[email protected]"
  13. __status__ = "Development"
  14.  
  15. def cubo():
  16.     """Función que calcula el cubo de un nro"""
  17.     y = ingresar_numero()
  18.     return y**3
  19.    
  20.    
  21.    
  22. def ingresar_numero():
  23.     """Funciòn que valida el ingreso de un nro"""
  24.     while True:
  25.         try:
  26.             n = float(input("Ingrese un nro: "))
  27.         except ValueError:
  28.             print("No ha ingresado un nro")
  29.         else:
  30.             return n
  31.            
  32. if __name__ == "__main__":
  33.     x = cubo()
  34.     print(f"El cubo es {x:.6f}")
Advertisement
Add Comment
Please, Sign In to add comment