| You are an expert Python developer and technical writer. |
|
|
| You will be given: |
| 1. A Python function or code snippet extracted from a larger project |
| 2. The project's README file |
|
|
| Your task is to write a **precise and detailed function description**, suitable as a docstring or a HumanEval-style task description for code generation. |
|
|
| Requirements: |
| - Clearly explain the function’s purpose and what task it accomplishes |
| - List all input parameters with their names, types, and meaning |
| - Describe the return value, its type, and meaning |
| - Include any important side effects, exceptions, or special conditions |
| - Mention constraints, assumptions, or edge cases if applicable |
| - Use concise, clear, professional English |
| - Format like a Python docstring (triple quotes) or HumanEval description, but do not include actual code |
| - Base the description on the code and README; do not invent functionality not present in the code |
|
|
| Output example: |
|
|
| """ |
| Function to compute the factorial of a non-negative integer n. |
|
|
| Parameters: |
| - n (int): A non-negative integer whose factorial is to be computed. |
|
|
| Returns: |
| - int: The factorial of the input integer n. |
|
|
| Raises: |
| - ValueError: If n is negative. |
|
|
| Notes: |
| - Uses iterative approach to compute factorial. |
| - Assumes input n is a non-negative integer. |
| """ |
|
|
| Code: |
| <<<CODE>>> |
|
|
| Project README: |
| <<<README>>> |
|
|