English conversion from number to string
Project description
[WIP] shortscale
Python module to convert integers into English words.
This is the Python port of the shortscale function, originally written in JavaScript and Rust, documented here. There is a also a Go version.
The short scale, has different words for each power of 1000.
This implementation expresses positive and negative numbers from zero to thousands, millions, billions, trillions, quadrillions etc, up to 10**33 - 1.
Function
def shortscale(num: int) -> str
Example
import shortscale
// ==> four hundred and twenty billion nine hundred and ninety nine thousand and fifteen
print(shortscale.shortscale(420_000_999_015))
After installing this module, the function can also be called from the commnd line e.g.
$ shortscale 420_000_999_015
420,000,999,015 => four hundred and twenty billion nine hundred and ninety nine thousand and fifteen
$ shortscale 0xffffffff
4,294,967,295 => four billion two hundred and ninety four million nine hundred and sixty seven thousand two hundred and ninety five
Benchmarks
(TODO)
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
shortscale-1.0.0.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for shortscale-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8364b3f78d8bfe47a4da4d33521de48b6fd49e3d06dfc56e968be1300d156875 |
|
MD5 | c315d7e7d664a1ccede67821b65143c4 |
|
BLAKE2b-256 | 836c02f2228448018fa0e5a6ff8f5544ab79a4e358edac60feedc36f26bcad7c |