Here are detailed code comments for a sample function. Since you didn't provide specific code, I'll use a common example (a function that calculates the factorial of a number) and demonstrate how to write thorough, professional comments. ```python def factorial(n): """ Calculate the factorial of a non-negative integer. The factorial of a number n (denoted as n!) is the product of all positive integers less than or equal to n. For example: 5! = 5 × 4 × 3 × 2 × 1 = 120
来自 Wikiprompt,自由的提示词百科全书
Here are detailed code comments for a sample function. Since you didn't provide specific code, I'll use a common example (a function that calculates the factorial of a number) and demonstrate how to write thorough, professional comments. ```python def factorial(n): """ Calculate the factorial of a non-negative integer. The factorial of a number n (denoted as n!) is the product of all positive integers less than or equal to n. For example: 5! = 5 × 4 × 3 × 2 × 1 = 120 一个提示,指示AI为代码添加全面注释,重点关注复杂函数、算法和关键决策,以帮助未来的开发者。
提示词内容收藏
🌐
Generate detailed comments for this code. Aim for clarity on complex functions, algorithms, or important decisions. The goal is to make the code understandable for future developers.
用法
此提示词专为 coding 设计。复制上方内容并粘贴到你常用的 AI 工具中。
为获得最佳效果,可将占位符(方括号或大写字母标示)替换为你的具体需求。
讨论
0 条评论