Skip to main content

Convert numbers into English words easily

Project description

📘 number_to_words

Convert integers into readable English words – simple, fast, and dependency-free.

PyPI version Python versions License: MIT


Overview

number_to_words is a lightweight Python package that converts numbers into English words. It supports values from 0 up to billions, formatted just like humans speak.

✔ No dependencies ✔ Fast and accurate ✔ Easy to import and use ✔ Clean modular implementation


Installation

Install using pip:

pip install number_to_words

Usage

Basic example

import number_to_words as nw

print(nw.num(45))        # forty five
print(nw.num(2024))      # two thousand twenty four
print(nw.num(987654321)) # nine hundred eighty seven million six hundred fifty four thousand three hundred twenty one

Importing the function directly

from number_to_words import num

print(num(123))  # one hundred twenty three

Supported Ranges

Range Example Output
0–13 zero → thirteen
14–19 fourteen → nineteen
20–99 twenty one, ninety nine
100–999 one hundred fifty two
1,000–999,999 twelve thousand three hundred ten
1,000,000–999,999,999 ninety eight million ...
1,000,000,000+ up to billions

Project Structure

number_to_words/
    __init__.py
    main.py
    ds.py
    tens.py
    hundreds.py
    thousands.py
    millions.py
    billions.py

Each module handles one specific number range, making the code easy to maintain and extend.


API Reference

num(x: int) -> str

Convert any integer to its English representation.

Example:

from number_to_words import num
num(1200305)

Output:

one million two hundred thousand three hundred five

Contributing

Contributions, issues, and pull requests are welcome.

If you find this package useful, please consider giving the repository a ⭐ on GitHub!


Contact

Author: Saumya Kanti Sarma Email: work.saumyasarma@gmail.com Instagram: saumya__sarma

Feel free to reach out for collaboration, questions, or feedback.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toword-0.0.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toword-0.0.1-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file toword-0.0.1.tar.gz.

File metadata

  • Download URL: toword-0.0.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for toword-0.0.1.tar.gz
Algorithm Hash digest
SHA256 acdd303e4b9efb86e8be34fab0dee4297f98e26be38c9144fadce491ddb89dfa
MD5 0d252e39545bf0999f8d8dbe4e08f70e
BLAKE2b-256 139fd0a2721a00f8b00214229be86f85cbb4b2dd0eed19418b781383fb198a5f

See more details on using hashes here.

File details

Details for the file toword-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: toword-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for toword-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d838e65e02dbb2d8c247b4f1c71a279d3cf26d9e8e27464276a0c7831a228c70
MD5 577cf8047129d781a10d608c85383d8a
BLAKE2b-256 6d89f5722b91af02bc886d47657171e370d5e058ea55ebf38409cc70008ce83a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page