Tirsvad c9e39f0445
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Skipped
TirSystem/git-workflows: Release / release (pull_request) Successful in 26s
TirSystem/git-workflows: Validate / validate (pull_request) Successful in 42s
TirSystem/git-workflows: OpenGrep / opengrep (pull_request) Successful in 5m47s
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Successful in 14s
TirSystem/git-workflows: Publish accepted milestones / publish (push) Successful in 59s
TirSystem/git-workflows: Validate / validate (push) Successful in 46s
TirSystem/git-workflows: OpenGrep / opengrep (push) Successful in 5m25s
Resolve the RC-013 commit link
2026-11-06 13:09:59 +08:00
2026-11-06 13:09:59 +08:00
2026-11-06 05:08:26 +01:00

🚀 Higher or Lower

Day 55 of Udemy's 100 Days of Code: The Complete Python Pro Bootcamp: a Higher or Lower guessing game as a Flask website, written for fellow course participants and for anyone who browses the repository for ideas.

📚 Table of Contents

🧭 Overview

The site picks a secret number between 0 and 9. Open / for the start page, then guess by putting a number in the URL, for example /3. The page tells you whether the guess is too low, too high or correct, with a different heading colour and GIF for each answer.

The repository also holds the small Flask programs of the day's lectures: URL paths, rendering HTML and decorators.

Part What it is for
server.py Starts the game, as the assignment asks
src/higher_lower/ The game, split in layers: domain, application, infrastructure, presentation
src/higher_lower/constants.py Every heading, colour, GIF and number range in one place
tests/ pytest tests
tools/ Script that captures the lecture screenshots in a Docker container
docs/ Project documents (business case, plan, milestones, reviews)
Doxyfile Settings to generate API documentation with Doxygen

Lecture steps

One screenshot for each lecture step. The wiki explains what each step teaches, in English, Danish and Bahasa Malaysia.

Step Code Screenshot
1. Goals: what you build server.py Start page of the game
2. URL paths and variable routes step_02_url_paths.py Route /username/Angela
3. Rendering HTML step_03_html.py Heading, paragraph and images
4. Decorators for HTML tags step_04_decorators.py Route /bye in bold, emphasis and underline
5. Advanced decorators with *args and **kwargs step_05_authenticated.py Logged in and logged out user
6. Final project: 3 is too low server.py 3 is too low
6. Final project: 7 is too high server.py 7 is too high
6. Final project: 5 is correct server.py 5 is correct

The lecture modules are in src/higher_lower/presentation/lectures/; run one with python -m higher_lower.presentation.lectures.step_02_url_paths. The screenshots were taken in a Docker container with a headless browser (bash tools/capture_screenshots.sh), not on a desktop.

📋 Requirements

  • Python 3.13 or later, to run the code.
  • Flask, the only runtime dependency, installed by the setup below.
  • pytest, to run the tests (installed with the test extra).
  • Doxygen, only if you want to generate the API documentation.

🛠️ Setup

Create a local virtual environment named .venv in the project folder, activate it, upgrade pip and install the project.

Windows (PowerShell):

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e ".[test]"

Linux and macOS:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[test]"

While the environment is active, the prompt starts with (.venv). Leave it with deactivate. Delete the .venv folder to start over.

▶️ Run

python server.py

Open http://127.0.0.1:5000/ in a browser, then try http://127.0.0.1:5000/3.

🧪 Tests

python -m pytest

Generate the API documentation with Doxygen into build/html:

doxygen Doxyfile

📄 License

GNU Affero General Public License v3.0, see LICENSE.

📎 Appendix: Project documents

The documents a newcomer needs, in reading order.

Document What it tells you
AGENTS.md The rules AI agents follow in this repository
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
Framework README The framework this project uses
Framework changelog What changed in each framework release

S
Description
Day 55 of Udemy's 100 Days of Code: a Higher or Lower number-guessing game as a Flask website, with tests and a wiki in English, Danish and Bahasa Malaysia.
Readme AGPL-3.0
1.1 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 97.9%
Shell 2.1%