| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Important
We love our community. We're grateful you are interested in improving the Python track.
But our maintainers are not accepting community contributions at this time.
If you would like to discuss possible future changes, please open a thread on the forum.
This community blog post contains more details.
Hi. 👋🏽 👋 We are happy you are here. 🎉 🌟
exercism/Python is one of many programming language tracks on exercism(dot)org.
This repo holds all the instructions, tests, code, & support files for Python exercises currently under development or implemented & available for students.
🌟 Track exercises support Python 3.10 - 3.13.5.
Exceptions to this support are noted where they occur.
🌟 Track tooling (test-runner, representer, analyzer, and Continuous Integration) runs on Python 3.13.5.
Exercises are grouped into concept exercises which teach the Python syllabus, and practice exercises, which are unlocked by progressing in the syllabus tree 🌴 . Concept exercises are constrained to a small set of language or syntax features. Practice exercises are open-ended, and can be used to practice concepts learned, try out new techniques, and play. These two exercise groupings can be found in the track config.json, and under the python/exercises directory.
It is not uncommon to discover typos, confusing directions, or incorrect implementations of certain tests or code examples. Or you might have a great suggestion for a hint to aid students ( 💙 ), see optimizations for exemplar or test code, find missing test cases to add, or want to correct factual and/or logical errors. Or maybe you have a great idea 💡 for an exercise or feature ( 💙 ).
Our track is always a work in progress! 🌟🌟
While contributions are paused, we ask that you open a thread in our community forum to let us know what you have found/suggest.
Our maintainers are not accepting community contributions at this time.
Until the pause on contributions ends, all PRs from the larger community will be automatically closed with a note.
We ask that you open a thread in our community forum to discuss any potential changes. Changes may or may not be approved, depending on the forum discussion.
Please read this community blog post for additional details.
We're leaving the track contributing docs below for our long-term collaborators and maintainers.
Non-code content (exercise introductions & instructions, hints, concept write-ups, documentation etc.) should be written in American English. We strive to watch the words we use.
When a word or phrase usage is contested | ambiguous, we default to what is best understood by our international community of learners, even if it "sounds a little weird" to a "native" American English speaker.
Our documents use Markdown, with certain alterations & additions. Here is our full Markdown Specification. 📐 We format/lint our Markdown with Prettier. ✨
If you have any questions or issues, don't hesitate to ask the maintainers -- they're always happy to help 💛 💙
Some of our code is old and does not (yet) conform to all these standards.
We know it, and trust us, we are working on fixing it. But if you see 👀 something, 👄 say something. It'll motivate us to fix it! 🌈
This track officially supports Python 3.10 - 3.13.5 for students completing exercises.
The track test runner, analyzer, and representer run in docker on python:3.13.5-alpine3.22.
Although the majority of test cases are written using unittest.TestCase,
All exercises should be written for compatibility with Python 3.10 - 3.13.5.
Version backward incompatibility (e.g an exercise using features introduced in Python 3.10+ that would not work in Python 3.10) should be clearly noted in any exercise hints, links, introductions or other notes.
Here is an example of how the Python documentation handles version-tagged 🏷 feature introduction.
Most exercises will work with Python 3.6+, and many are compatible with Python 2.7+. Please do not change existing exercises to add new language features without consulting with a maintainer first. We 💛 💙 modern Python, but we also want to avoid student confusion when it comes to which Python versions support brand-new features.
Each exercise must be self-contained. Please do not use or reference files that reside outside the given exercise directory. "Outside" files will not be included if a student fetches the exercise via the CLI.
Each exercise/problem should include a complete test suite, an example/exemplar solution, and a stub file ready for student implementation.
For specifications, refer to Concept Exercise Anatomy, or Practice Exercise Anatomy depending on which type of exercise you are contributing to.
Practice exercise descriptions and instructions come from a centralized, cross-track problem specifications repository.
Practice Exercise Test Suits for most practice exercises are similarly auto-generated from data in problem specifications.
Our tooling (runners, analyzers and representers) runs in isolated containers within the exercism website. Because of this, exercises cannot rely on third-party or external libraries. Any library needed for an exercise or exercise tests must be incorporated as part of the tooling build, and noted for students who are using the CLI to solve problems locally.
If your exercise depends on a third-party library (aka not part of standard Python), please consult with maintainers about it. We may or may not be able to accommodate the package.
Practice exercises inherit their definitions from the problem-specifications repository in the form of description files. Exercise introductions, instructions and (in the case of many, but not all) test files are then machine-generated for each language track.
Changes to practice exercise specifications should be raised/PR'd in problem-specifications and approved by 3 track maintainers. After an exercise change has gone through that process, related documents and tests for the Python track will need to be re-generated via configlet. Configlet is also used as part of the track CI, essential track and exercise linting, and other verification tasks.
If a practice exercise has an auto-generated <exercise_slug>_test.py file, there will be a .meta/template.j2 and a .meta/tests.toml file in the exercise directory. If an exercise implements Python track-specific tests, there may be a .meta/additional_tests.json to define them. These additional_tests.json files will automatically be included in test generation.
Exercise Structure with Auto-Generated Test Files
[<exercise-slug>/
├── .docs
│ └── instructions.md
├── .meta
│ ├── config.json
│ ├── example.py
│ ├── template.j2
│ └── tests.toml
├── <exercise_slug>.py #stub file
└── <exercise_slug_test.py #test filePractice exercise <exercise_slug>_test.py files are generated/regenerated via the Python Track Test Generator.
Please reach out to a maintainer if you need any help with the process.
If an unimplemented exercise has a canonical-data.json file in the problem-specifications repository, a generation template must be created. See the Python track test generator documentation for more information.
If an unimplemented exercise does not have a canonical-data.json file, the test file must be written manually.
Example solution files serve two purposes only:
Unlike concept exercise, practice exercise example.py files are NOT intended as as a "best practice" or "standard".
They are provided as proof that there is an acceptable and testable answer to the practice exercise.
Implementing Track-specific Practice Exercises is similar to implementing a canonical exercise that has no canonical-data.json. But in addition to the tests, the exercise documents (instructions, etc.) will also need to be written manually. Carefully follow the structure of generated exercise documents and the exercism practice exercise specification.
1. A local clone of the problem-specifications repository.
2. configlet
For Individual Exercises
configlet generate <path/to/track> --spec-path path/to/problem/specifications --only example-exerciseFor all Practice Exercises
configlet generate <path/to/track> --spec-path path/to/problem/specifications| Back | FazBrowse Home | New Git URL |