Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте 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.

Завдання

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.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 4
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Suggested prompts:

Can you give me an example function to write a docstring for?

What are the best practices for writing Python docstrings?

Can you show me a sample docstring format?

close

Awesome!

Completion rate improved to 5.26

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.

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 4
single

single

some-alt