A python3 module that converts numbers to English words. For example "5" -> "five"
Project description
IntegerWords
Converts integers to English words. For example, convert 331002651 to "three hundred thirty one million two thousand six hundred fifty one".
Installation
pip3 install IntegerWords
Alternative Installation
First install build from pip:
pip3 install build
Then, clone this repo, package IntegerWords manualy and install from local package.
user@machine:~/IntegerWords$ python3 -m build
user@machine:~/IntegerWords$ pip3 install dist/*
Bash / CLI Usage:
Use on the command line.
user@machine$ python3 -m IntegerWords 331002651
three hundred thirty one million two thousand six hundred fifty one
user@machine$
API Usage:
Use in your python programs by importing IntegerWords as a python3 module.
import IntegerWords
def main():
num = 331002651
print(IntegerWords.EnglishInteger(num))
Python Interpreter Usage:
Use directly in the python3 interpreter.
user@machine$ python3
>>> from IntegerWords import intw
>>> intw(331002651)
three hundred thirty one million two thousand six hundred fifty one
>>>
Details
- Negative numbers are not yet supported.
- Integers only.
- Maximum supported value is 999,999,999,999,999,999,999,999,999,999,999,999 (i.e., 999 decillion followed by subsequent 9's)
- This program never outputs the word "and." For example, when inputting 3001 the output is "three thousand one" not "three thousand and one" This is acceptable grammar in the United States, but it may seem a bit odd in some cases. For example, when inputting 3000001 the output is "three million one." This may seem more awkward than the more colloquial "three million and one", but it is the intended output.
- For documentation about the API consider reading the source code in
IntegerWords.py
- Inputs with delimiters other than commas are currently not supported (e.g., "331.002.651").
Pull Requests
Don't like something? Make a pull request. This is a very simple project and should be accessible to even beginner programmers.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file IntegerWords-1.0.tar.gz
.
File metadata
- Download URL: IntegerWords-1.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a805bd09f6713f51ceda7e682f91d69b973ef89537e689c98c1b19b3deba0bf |
|
MD5 | 72198e14f5f76fa8bb8e0bf93ce6b5e7 |
|
BLAKE2b-256 | 4c947cb0f18d0cb25f79cde4f664c00e800f084400cb27a2f0ebedf15537c74f |
File details
Details for the file IntegerWords-1.0-py3-none-any.whl
.
File metadata
- Download URL: IntegerWords-1.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10a8d37577b10a065ed8c34303b26024b1d34890eee5738bc7e9522ba9f2d730 |
|
MD5 | 8b23728acb766b2feae5bb955f97c9ce |
|
BLAKE2b-256 | 7b5f2cd16efc07b634c741085e870d6cf11844370e71b5a3c70b9e355a4b9dfe |