Skip to content

H9A logo

H9A — How Many 9 in 1 to 100

A CLI tool and Python library that counts how many times a digit appears in a range of numbers, with a colorized step-by-step breakdown.

Overview

H9A is an installable Python package that counts how many times a given digit appears in a range of numbers (by default: the digit 9 between 1 and 100). It provides both a h9a command-line tool and an importable library, and it prints each step of the calculation — the per-place counts and the combined total — as styled, colorized output. It is built with rich for console formatting, pyfiglet for an ASCII-art banner, and Pillow for optional terminal-style screenshots.

Quick start

python -m pip install rich pyfiglet
python -m h9a

The final line tells you how many times the digit appears. The default answer for the digit 9 between 1 and 100 is 20 (10 in the ones place plus 10 in the tens place; 99 is counted in both).

Key features

  • Installable package: pip install . provides the h9a command and the h9a library.
  • CLI options: --digit, --start, --end, --json, --no-color, --screenshot, and --version.
  • Library API: count_digit() returns a DigitCount with a per-place breakdown.
  • Step-by-step output with a count for each decimal place (ones, tens, hundreds, ...).
  • Colorized output via rich, ASCII-art banner via pyfiglet.
  • Terminal-style screenshots generated with Pillow.

Documentation

Page Description
Getting Started From a clean environment to the first run.
Installation Installing the package, dependencies, and the Docker option.
Usage What the output means, step by step.
Command-Line Interface The h9a command reference.
Library API Using H9A inside your own programs.
Architecture How the package is structured.
Configuration CLI options; no config files are used.
Development Cloning, running, and modifying the source.
Deployment Running H9A directly or in Docker.
FAQ Frequently asked questions.
Troubleshooting Common errors and fixes.
Screenshots The generated screenshot gallery.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Also available on GitHub.