Thank you for your interest in contributing to this Python learning resource! This document provides guidelines for adding new content, improving existing materials, and maintaining consistency across the repository.
- New Topics - Add new learning topics to any level
- New Problems - Create practice problems for existing topics
- Improvements - Enhance explanations, examples, or exercises
- Fixes - Correct errors, typos, or broken links
- Documentation - Improve READMEs or add helpful notes
- Check existing topics to avoid duplication
- Review the templates in
.templates/directory - Ensure your Python code follows PEP 8 style guidelines
- Test all code examples to ensure they work correctly
Each topic should include:
-
README.md - Main learning content
- 2-3 paragraph introduction explaining the topic and its importance
- 5-8 specific learning objectives
- Prerequisites with links to earlier topics
- Table of contents linking to all files
- Link to related problems
- Navigation to next recommended topic
-
examples.py - Working code examples
- 2-3 complete, runnable examples
- Detailed comments explaining each line
- Progressive complexity (basic → intermediate)
- Include expected output in comments
-
exercises.md - Guided practice
- 3-5 practice exercises
- Difficulty progression (easy → medium → hard)
- Clear instructions and expected outcomes
- Hints for approach (not full solutions)
-
key-concepts.md - Quick reference
- Bullet-point summary of main concepts
- Syntax quick reference
- Common patterns and idioms
- Pitfalls to avoid
Each problem set should include:
-
problem-N.md - Problem statement
- Clear, specific problem description
- Input/output specifications
- 2-3 example test cases with expected results
- Constraints and requirements
- Difficulty level and time estimate
- Link to related learning material
-
problem-N-hint.md - Progressive hints
- 3-4 progressive hints (from general approach to specific steps)
- Each hint should guide without giving away the solution
- Final hint can be more detailed
-
problem-N-solution.py - Complete solution
- Working, well-commented code
- Explanation of the approach
- Alternative solutions if applicable
- Test cases demonstrating correctness
-
problem-N-performance.md - Analysis
- Time complexity analysis
- Space complexity analysis
- Optimization opportunities
- Comparison of different approaches
Use numbered prefixes for clear ordering:
01-topic-name/
02-another-topic/
03-yet-another-topic/
learning-guide/
├── beginner/
│ ├── README.md (level overview)
│ ├── 01-topic-name/
│ │ ├── README.md
│ │ ├── examples.py
│ │ ├── exercises.md
│ │ └── key-concepts.md
│ └── 02-next-topic/
├── intermediate/
└── advanced/
problems/
├── beginner/
│ ├── README.md (level overview)
│ ├── 01-topic-name/
│ │ ├── problem-1.md
│ │ ├── problem-1-hint.md
│ │ ├── problem-1-solution.py
│ │ ├── problem-1-performance.md
│ │ ├── problem-2.md
│ │ └── ... (2-3 problems per topic)
│ └── 02-next-topic/
├── intermediate/
└── advanced/
Use templates from .templates/ directory to ensure consistency:
topic-README-template.md- For learning guide topicsexamples-template.py- For example code filesexercises-template.md- For exercise fileskey-concepts-template.md- For quick reference guidesproblem-template.md- For problem statementshint-template.md- For hint filessolution-template.py- For solution codeperformance-template.md- For performance analysis
Copy the appropriate template and fill in the content.
-
PEP 8 Compliance
- Use 4 spaces for indentation
- Maximum line length of 88 characters (Black formatter default)
- Use descriptive variable names
- Follow naming conventions (snake_case for functions/variables)
-
Comments
- Explain why, not just what
- Use docstrings for functions and classes
- Keep comments up-to-date with code changes
-
Examples Must Work
- All example code must execute without errors
- Include print statements to show output
- Test on Python 3.8+ before submitting
-
Links
- Use relative links for internal navigation
- Verify all links work before committing
-
Code Blocks
- Always specify language:
```python - Include expected output when helpful
- Always specify language:
-
Formatting
- Use headers hierarchically (don't skip levels)
- Keep lines under 100 characters when possible
- Use lists for scannable content
Before submitting, verify:
-
Code Runs
# Test all Python files python3 your-file.py -
No Syntax Errors
python3 -m py_compile your-file.py
-
Links Work
- Click through all internal links
- Verify relative paths are correct
-
Consistent Style
- Compare with existing topics
- Use templates as guides
<type>: <subject>
<body (optional)>
feat:- New topic or problemcontent:- Improvements to existing contentfix:- Bug fixes or correctionsdocs:- Documentation updatesstyle:- Formatting, no code changerefactor:- Code restructuring
feat: Add beginner topic on list comprehensions
Add complete learning material and 3 practice problems
for list comprehensions topic.
---
fix: Correct example in control-flow topic
Fix syntax error in if-else example.
---
content: Expand error handling explanations
Add more context around try/except best practices
and common error types.
- Submit your changes
- Ensure all tests pass
- Respond to feedback
- Make requested changes
- Get approval and merge
If you have questions about contributing:
- Open an issue for discussion
- Check existing topics as examples
- Refer to templates in
.templates/
Thank you for helping make this a better learning resource! 🎓