ComenzarEmpieza gratis

Optimizing prompts for code documentation

You've been working at the banking company for a long time now, and have maintained a large Python codebase for years. Now, a new intern is joining, and you realize all that knowledge lives in your head. You decide to use an AI assistant to start documenting the codebase.

To test the feasibility of this approach, you decide to start with a single function, saved in interest.py, a file the LLM can read and use:

def calculate_interest(balance, rate, years):
  return balance * (1 + rate) ** years

Este ejercicio forma parte del curso

AI-Assisted Coding for Developers

Ver curso

Instrucciones del ejercicio

- Prompt the model to **add docstrings** to the function, **specify a standard** (e.g., Google style docstrings), and **require sections** for purpose of the function, arguments (names/types), return type, and optionally examples.

Ejercicio interactivo práctico

Pon en práctica la teoría con uno de nuestros ejercicios interactivos

Empezar ejercicio