Advertisement
teslariu

modulo cubo

Aug 17th, 2022 (edited)
1,042
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. """Módulo que calcula el cubo de un número"""
  6.  
  7. __author__ = "Ale"
  8. __copyright__ = "Python Developers"
  9. __credits__ = ["Gabriel","Juan","Ana"]
  10. __license__ = "GPLv3"
  11. __version__ = "0.2"
  12. __email__ = "tatuss_arroba_ciudad.com.ar"
  13. __status__ = "Development"
  14.  
  15. def ingresar():
  16.     """Función que valida el ingreso de un número"""
  17.     while True:
  18.         try:
  19.             x = float(input("Ingrese un número: "))
  20.         except ValueError:
  21.             print("Debe ingresar un número")
  22.         else:
  23.             return x
  24.            
  25. def cubo(x):
  26.     """Calcula el cubo de un número"""
  27.     return x**3
  28.    
  29. if __name__ == "__main__":
  30.     x = ingresar()
  31.     print(f"El cubo de {x} es {cubo(x)}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement