teslariu

aritmetica

Jan 19th, 2023
999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """Modulo que implementa diversas funciones aritmèticas"""
  5.  
  6. __author__ = "ALB"
  7. __copyright__ = "Educacion IT"
  8. __credits__ = ["Juan", "Ana", "Victor"]
  9. __license__ = "GPLv3"
  10. __version__ = "0.9"
  11. __email__ = "[email protected]"
  12. __status__ = "Development"
  13.  
  14.  
  15. def cubo(x):
  16.     """Función que recibe un nro como argumento y devuelve su cubo"""
  17.     return x ** 3
  18.    
  19. def ingresar_nro():
  20.     while True:
  21.         try:
  22.             nro = float(input("Ingrese un nro: "))
  23.         except ValueError:
  24.             print("Error: debe ingresar un número")
  25.         else:
  26.             return nro
  27.            
  28. if __name__ == '__main__':
  29.     """Ejemplo de uso de las funciones del módulo aritmetica.py"""
  30.     numero = ingresar_nro()
  31.     print(f"El cubo de {numero} es {cubo(numero)}")
  32.  
Advertisement
Add Comment
Please, Sign In to add comment