Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer 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.

Taak

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.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 4. Hoofdstuk 4
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

Awesome!

Completion rate improved to 5.26

bookChallenge: Write Docstrings

Veeg om het menu te tonen

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.

Taak

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 4. Hoofdstuk 4
single

single

some-alt