Interactive Python exercises with Ruff linting - Learn Python by fixing and completing code!
# Clone the repository
git clone https://github.com/armanrasta/snakers.git
cd snakers
# Install dependencies
pip install -e .# Create exercises directory and files in current directory
snakers init
# Create in a specific directory
snakers init --target /path/to/directory# If installed via pip
snakers run
# Or using the module
python -m snakers runsnakers run 01_variables/01_basic_typessnakers watchsnakers listsnakers reset# List all saved solutions
snakers solutions list
# View a specific solution
snakers solutions show 01_basic_types
# Reset all solutions
snakers solutions reset# General help
snakers help
# Topic-specific help
snakers help init
snakers help solutionsExercises are organized in the exercises/ directory by topic:
00_intro/- Introduction and environment setup01_variables/- Variables, types, basic operations02_collections/- Lists, dictionaries, tuples, sets03_functions/- Function definitions, parameters, returns04_control_flow/- Conditionals, loops, flow control05_exceptions/- Error handling and exceptions06_classes/- Object-oriented programming07_functional/- Functional programming concepts08_file_io/- File operations and data formats09_modules_packages/- Imports, packages, modules10_advanced/- Decorators, generators, advanced concepts11_testing/- Unit testing and test-driven development12_concurrency/- Threading, multiprocessing, async programming13_data/- Data processing and analysis14_web/- HTTP clients and web programming15_stdlib/- Standard library modules16_project_management/- Virtual environments, packaging, project structure17_design_patterns/- Common design patterns18_regex/- Regular expressions
Each exercise file contains:
- Learning objectives
- TODO items to complete
- Hints and tips
- Test cases
- Find TODOs: Each exercise has
# TODOcomments marking what you need to implement - Fix the code: Replace TODOs with working Python code
- Pass Ruff checks: Your code must pass Ruff linting (style, formatting, basic errors)
- Run successfully: The exercise file must execute without runtime errors
- Progress tracking: Completed exercises are automatically tracked
Snakers uses Ruff for:
- Code formatting
- Style checking (PEP 8)
- Error detection
- Import sorting
- Modern Python practices
- Fork the repository
- Add new exercises in the appropriate topic directory
- Follow the existing exercise format
- Test your exercises
- Submit a pull request
"""
Exercise N: Title
Description of what the student will learn.
Tasks:
1. Task description
2. Another task
Hints:
- Helpful hint
- Another hint
"""
# TODO: Implementation task
def example_function():
# TODO: Implement this function
pass
if __name__ == "__main__":
# Test code here
passHappy coding! 🐍✨