LoslegenKostenlos loslegen

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

Diese Übung ist Teil des Kurses

AI-Assisted Coding for Developers

Kurs anzeigen

Anleitung zur Übung

- 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.

Interaktive Übung

In dieser interaktiven Übung kannst du die Theorie in die Praxis umsetzen.

Übung starten