Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
- Be respectful and inclusive
- Provide constructive feedback
- Help others learn and grow
- No harassment or discrimination
Click the "Fork" button in the top-right corner of the GitHub page.
# Clone your fork
git clone https://github.com/yourusername/python-examples.git
cd python-examplesAlways create a new branch for your work:
git checkout -b feature/your-feature-namefeature/add-list-examples- for new featuresfix/correct-typo-in-docs- for bug fixesdocs/improve-readme- for documentation improvementstest/add-unit-tests- for test additions
- Follow PEP 8 style guide
- Use meaningful variable names
- Add comments for complex logic
- Keep functions small and focused
- Use type hints where appropriate
def validate_age(age: int) -> bool:
"""
Validate if age is within acceptable range.
Args:
age: The age to validate
Returns:
True if age is valid, False otherwise
"""
return 0 <= age <= 150- Add docstrings to all functions
- Include example usage in comments
- Update README if adding new examples
- Keep explanations clear and beginner-friendly
Write clear, descriptive commit messages:
git commit -m "Add: New example for list comprehension"- Start with a type:
Add,Fix,Docs,Test,Refactor - Use present tense ("add" not "added")
- Be specific about what changed
- Keep it under 72 characters
git push origin feature/your-feature-name- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your branch
- Add a clear title and description
- Submit the pull request
## Description
Brief description of what this PR does.
## Type of Change
- [ ] New feature
- [ ] Bug fix
- [ ] Documentation update
- [ ] Code improvement
## Changes
- Change 1
- Change 2
- Change 3
## Testing
How to test these changes:
1. Run `python examples.py`
2. Verify output matches expected results
## Related Issues
Closes #(issue number)We welcome new beginner-friendly Python examples!
Requirements:
- Code should demonstrate a single concept clearly
- Include comments explaining the logic
- Provide example output
- Suggest learning concepts
- Update README with the new example
Example Template:
# ============================================================================
# Example 6: List Basics
# ============================================================================
# This example demonstrates creating and accessing lists in Python
# Create a list
numbers = [1, 2, 3, 4, 5]
# Access elements by index
print(numbers[0]) # Output: 1
print(numbers[-1]) # Output: 5
# Slice a list
print(numbers[1:3]) # Output: [2, 3]
# Loop through a list
for num in numbers:
print(num)- Fix typos and grammatical errors
- Clarify explanations
- Add more examples
- Improve formatting
- Update links and resources
- Report bugs in issues first
- Include steps to reproduce
- Provide expected vs actual behavior
- Submit a fix with explanation
- Add unit tests in
tests/directory - Use Python's
unittestorpytest - Aim for good code coverage
- Test edge cases
- Improve code readability
- Optimize performance
- Refactor repetitive code
- Add type hints
- Code follows PEP 8 style guide
- All functions have docstrings
- Comments explain complex logic
- Code is tested and working
- README is updated if needed
- No unnecessary files added
- Commit messages are clear
- PR description explains changes
python examples.pypython -m pytest tests/
# or
python -m unittest discover- Add more beginner-friendly examples
- Improve code comments
- Add unit tests
- Fix documentation typos
- Add advanced examples
- Create example breakdown videos
- Add interactive exercises
- Improve error messages
- Add more learning resources
- Create comparison charts
- Build a progression guide
- Add visual diagrams
- Check existing issues first
- Search the documentation
- Ask in discussions
- Open a new issue with details
Include:
- Clear title
- Detailed description
- Steps to reproduce (if bug)
- Expected vs actual behavior
- Python version and OS
- Relevant code snippets
Contributors will be recognized in:
- This CONTRIBUTING.md file
- Project README
- Release notes
- GitHub contributors page
Questions about contributing? Feel free to:
- Open a discussion
- Check existing issues
- Reach out to maintainers
Thank you for contributing! 🌟
Your help makes this project better for everyone learning Python.