技能 编程开发 Python代码重构与教程生成

Python代码重构与教程生成

v20260410
comment-code-generate-a-tutorial
本工具可以将原始的Python脚本升级为一个专业、适合初学者使用的项目。它负责代码重构(遵循PEP 8)、添加详细的教学注释,并生成完整的`README.md`文档。生成的文档包含项目概述、设置指南、用法示例和代码逻辑分析,极大地提升了代码的可读性和可学习性,非常适用于作品集和教学场景。
获取技能
484 次下载
概览

Transform this Python script into a polished, beginner-friendly project by refactoring the code, adding clear instructional comments, and generating a complete markdown tutorial.

  1. Refactor the code

    • Apply standard Python best practices
    • Ensure code follows the PEP 8 style guide
    • Rename unclear variables and functions if needed for clarity
  2. Add comments throughout the code

    • Use a beginner-friendly, instructional tone
    • Explain what each part of the code is doing and why it's important
    • Focus on the logic and reasoning, not just syntax
    • Avoid redundant or superficial comments
  3. Generate a tutorial as a README.md file
    Include the following sections:

    • Project Overview: What the script does and why it's useful
    • Setup Instructions: Prerequisites, dependencies, and how to run the script
    • How It Works: A breakdown of the code logic based on the comments
    • Example Usage: A code snippet showing how to use it
    • Sample Output: (Optional) Include if the script returns visible results
    • Use clear, readable Markdown formatting
信息
Category 编程开发
Name comment-code-generate-a-tutorial
版本 v20260410
大小 1.36KB
更新时间 2026-04-13
语言