Repository navigation
Description
Student: Paulami Bhosle
Task: R23-T055 · 5 of 10
Repository: https://github.com/S-AI-Projects/TheAlgorithms-Python
Assigned working branch: student/e26b07f0792
Goal
Use a debugger to watch the algorithm run on a small input, and turn your observations into documentation and a test. Trace extended_euclid(10, 6) and chinese_remainder_theorem(5, 1, 7, 3) by hand and with pdb.
Steps
- Choose a small input (from a doctest or your own) and step through with
python -m pdbor breakpoint(); record the key variables at each step. - Write work/R23-T055/TRACE.md as a table of steps and variable values.
- Turn one observation into a new doctest (e.g. an intermediate value or an edge case you discovered).
- Explain one thing that surprised you.
- Make the code change in the repository: maths/chinese_remainder_theorem.py: doctests for intermediate results of extended_euclid and a non-coprime input. Re-run the automated check and the repo's own tests afterwards.
- Prepare the PR: on branch R23-T055, commit the code change plus your work/R23-T055/ evidence, put your findings in the PR description and open the PR against the org fork. For a later upstream PR, create a second branch containing only the code change (no work/ folder).
Done when
☐ TRACE.md traces extended_euclid(10, 6) step by step and chinese_remainder_theorem(5, 1, 7, 3).
☐ maths/chinese_remainder_theorem.py gains doctests for an intermediate result and a non-coprime input (documented behaviour).
☐ Existing 8 doctests pass (maths/chinese_remainder_theorem.py).
Additional task guidance
Additional curated task guidance
Item:
maths/chinese_remainder_theorem.py (96 lines; 8 doctests)
Task type:
Trace the execution
Code change (goes into the PR):
maths/chinese_remainder_theorem.py: doctests for intermediate results of extended_euclid and a non-coprime input.
Automated check:
uv run pytest maths/chinese_remainder_theorem.py
Prerequisites:
Linux/WSL2/Codespaces with uv (https://docs.astral.sh/uv/getting-started/installation/); run uv sync --group=test once – it installs the Python version CI uses (.python-version = 3.15t) and the test dependencies, about 1–2 GB
Upstream PR rules:
Follow CONTRIBUTING.md: type hints on every parameter/return, doctests for valid and erroneous input, snake_case file names, no duplicate of an existing implementation, no hand edits to DIRECTORY.md. CI (pytest with doctests, ruff) must pass – bots close PRs without tests or type hints. Keep work/ (benchmarks, notes, property tests) out of the upstream branch; put results in the PR description.
Source (pinned):
https://github.com/TheAlgorithms/Python/blob/574d100b7181956e9c8384552fd078165e4cc326/maths/chinese_remainder_theorem.py
Change:
No change recorded
PR destination:
Preserved pilot guidance
Submission checklist
- Complete this task and its checks.
- Add the required evidence and link your pull request here.
- Select this S-AI-Projects fork as the PR base repository.
- Request instructor review.
Keep this PR focused on this task. Do not submit assignment PRs to the upstream repository.
Activity