DEV Community

Cover image for Ibuprofeno.py💊| #140: Explica este código Python
Cristian Fernando
Cristian Fernando

Posted on

1 1 1 1

Ibuprofeno.py💊| #140: Explica este código Python

Explica este código Python

Dificultad: Fácil

def f(a,b):
    """
    f suma dos numeros pasados por parametro
    a -> int
    b -> int
    """
    return a + b

print(help(f))
Enter fullscreen mode Exit fullscreen mode
  • A. None
  • B. SyntaxError
  • C. 0
  • D.
    f suma dos numeros pasados por parametro
    a -> int
    b -> int
Enter fullscreen mode Exit fullscreen mode

Respuesta:
  • D.
    f suma dos numeros pasados por parametro
    a -> int
    b -> int
Enter fullscreen mode Exit fullscreen mode

En Python podemos documentar una función haciendo uso del comentario con triple comilla (dentro de la función per ser) y posteriormente llamando a la función help() con el nombre de la función.

De esta manera veremos toda la documentación de la función por consola.

La función help() no solo sirve para funciones propias, sino que también puede usarse con cualquier función pre definida de Python.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site