Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Write Docstrings | Sustaining Code Quality
Code Quality and Refactoring in Python

bookChallenge: Write Docstrings

In this challenge, you will practice writing docstrings for Python functions. Docstrings are essential for documenting what a function does, its parameters, and its return value. Your task is to read each function and write a clear, concise docstring that explains its purpose, describes its parameters, and specifies what it returns. This exercise will help you develop the habit of documenting your code for yourself and others.

Tarea

Swipe to start coding

Add appropriate docstrings to the following Python functions. For each function:

  • Write a docstring immediately after the function definition line.
  • Clearly describe the function's purpose.
  • List and describe each parameter.
  • Describe the return value.
  • Use triple double quotes for the docstring.

Solución

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 4
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

close

Awesome!

Completion rate improved to 5.26

bookChallenge: Write Docstrings

Desliza para mostrar el menú

In this challenge, you will practice writing docstrings for Python functions. Docstrings are essential for documenting what a function does, its parameters, and its return value. Your task is to read each function and write a clear, concise docstring that explains its purpose, describes its parameters, and specifies what it returns. This exercise will help you develop the habit of documenting your code for yourself and others.

Tarea

Swipe to start coding

Add appropriate docstrings to the following Python functions. For each function:

  • Write a docstring immediately after the function definition line.
  • Clearly describe the function's purpose.
  • List and describe each parameter.
  • Describe the return value.
  • Use triple double quotes for the docstring.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 4
single

single

some-alt