Interactive Python exercises for upcoming Junior learners - Learn Python by fixing code!
Project description
Snakers 🐍
Interactive Python exercises with Ruff linting - Learn Python by fixing and completing code!
Installation
# Initialize a virtual enviorentment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the package
python3 -m pip install snakers
Usage
Initialize the exercises
# Create exercises directory and files in current directory
snakers init
# Create in a specific directory
snakers init --target /path/to/directory
Run the next exercise
# If installed via pip
snakers run
# Or using the module
python -m snakers run
Run a specific exercise
snakers run 01_variables/01_basic_types
Watch mode (auto-check on file changes)
snakers watch
List all exercises
snakers list
Reset progress
snakers reset
Manage solutions
# List all saved solutions
snakers solutions list
# View a specific solution
snakers solutions show 01_basic_types
# Reset all solutions
snakers solutions reset
Get help
# General help
snakers help
# Topic-specific help
snakers help init
snakers help solutions
Exercise Structure
Exercises 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
How It Works
- 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
Ruff Configuration
Snakers uses Ruff for:
- Code formatting
- Style checking (PEP 8)
- Error detection
- Import sorting
- Modern Python practices
Contributing
- Fork the repository
- Add new exercises in the appropriate topic directory
- Follow the existing exercise format
- Test your exercises
- Submit a pull request
Exercise Template
"""
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
pass
Happy coding! 🐍✨
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
snakers-0.1.6.tar.gz
(76.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
snakers-0.1.6-py3-none-any.whl
(104.6 kB
view details)
File details
Details for the file snakers-0.1.6.tar.gz.
File metadata
- Download URL: snakers-0.1.6.tar.gz
- Upload date:
- Size: 76.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bd46fad5c0466630a65bcb9616eba34cd1075a0bae1748d0e74587452f2a6a2
|
|
| MD5 |
1212bc294c77f8784ce9b3ec8b2da269
|
|
| BLAKE2b-256 |
d35ab718120256e7cde83e5fe79da22c38b26018bf40fae16295e9d977d39be2
|
File details
Details for the file snakers-0.1.6-py3-none-any.whl.
File metadata
- Download URL: snakers-0.1.6-py3-none-any.whl
- Upload date:
- Size: 104.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c51e2314ed613da2f067c6c334feb14307ab8e11443b2d43536fbca8d3000abb
|
|
| MD5 |
8c97ea4b108278ef332b96ecdff2f9fe
|
|
| BLAKE2b-256 |
7e521b9f6c0208b72a6c287f908f9c2eac2679ef3e98c32b9db7576c513640a6
|