main
TirSystem/git-workflows: Release / release (push) Skipped
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Successful in 17s
TirSystem/git-workflows: Publish accepted milestones / publish (push) Successful in 29s
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Successful in 38s
TirSystem/git-workflows: Validate / validate (push) Successful in 35s
TirSystem/git-workflows: OpenGrep / opengrep (push) Successful in 1m35s
🐞 Debugging
Day 13 of Udemy's 100 Days of Code: Python Pro Bootcamp: finding and fixing bugs in Python code.
📚 Table of Contents
🧭 Overview
All exercises live in src/main.py, each commented out with the
fix noted beside it. Uncomment one at a time to run it.
Exercises
| Exercise | Bug | Fix |
|---|---|---|
| Describe the Problem | range(1, 20) never reaches 20, because the upper bound is excluded |
Use range(1, 21) |
| Reproduce the Bug | dice_imgs[dice_num] raises IndexError when the roll is 6 |
Index with dice_num - 1 |
| Play Computer | A birth year of exactly 1994 matches no branch | Use >= in the elif |
| Fix the Errors | input() returns a string, so age > 18 fails; the print is not indented |
Convert with int(); indent the print |
| Print is Your Friend | == compares instead of assigning, so word_per_page stays 0 |
Use = |
| Use a Debugger | b_list.append(new_item) sits outside the loop, so only the last item is kept |
Indent it into the loop |
Debugging approach
- Describe the problem in your own words.
- Reproduce the bug.
- Play computer: step through the code by hand.
- Fix the errors the interpreter reports.
- Use
print()to inspect values. - Use a debugger to step through execution.
📋 Requirements
Python 3.
🛠️ Setup
No installation is needed: the exercises use only the Python standard library. Clone the repository and run the program from its root.
▶️ Run
python src/main.py
🧪 Tests
The project has no automated tests. Check that the exercise file compiles:
python -m py_compile src/main.py
📄 License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE.
🔗 Links
📎 Appendix: Project documents
The documents a newcomer needs, in reading order.
| Document | What it tells you |
|---|---|
| Business Case | Why the project exists, its scope and success criteria |
| Stakeholder Analysis | Who is involved; the stakeholder IDs used for owners and reviewers |
| Project Plan | The gateways and their schedule |
| Milestones | One document per gateway: Go/No-Go criteria and tasks |
| Artifact registry | Where each artifact type lives, the next version, the PO language and domain |
| Traceability matrix | How the artifacts link and when each was last reviewed |
Languages
Python
100%