Knowledge Card - Effective Documentation Tips

Effective Documentation Tips

  1. Describe Purpose: Clearly state what the function does.

    • Example: # Calculates the area of a rectangle given its length and width
  2. List Parameters: Include details about each parameter.

    • Example: # Parameters: length (int), width (int)
  3. Explain Return Values: Describe what the function returns.

    • Example: # Returns: area (float)
  4. Provide Examples: Include sample calls and outputs.

    • Example: # Example: calculate_area(5, 3) returns 15