Skip to main content

Simple package that converts numbers (int and float)

Project description

NUM_TO_STR_REPR

Simple package that converts numbers (int and float) to the Russian and Ukrainian string representation.

The supported number in range [-googol, googol].

Installation

Use the package manager pip to install num-to-str-repr.

pip install num-to-str-repr

Example

By default the language is Russian.

from num_to_str_repr.number_converter import NumberConverter

converter = NumberConverter()

# Int number
converter.convert(789_567_361_890_000_321)
"семьсот восемьдесят девять квадриллионов пятьсот шестьдесят семь триллионов триста шестьдесят один миллиард восемьсот девяносто миллионов триста двадцать один"

# Float number
converter.convert(534.321)
"пятьсот тридцать четыре целых триста двадцать одна тысячная"
from num_to_str_repr.number_converter import NumberConverter

converter = NumberConverter("UA")

# Int number
converter.convert(789_567_361_890_000_321)
"сімсот вісімдесят дев'ять квадрильйонів п'ятсот шістдесят сім трильйонів триста шістдесят один мільярд вісімсот дев'яносто мільйонів триста двадцять один"

# Float number
converter.convert(132.41)
"сто тридцять дві цілих сорок одна сота"

Run tests

python3 -m unittest tests.num_to_str_repr

License

MIT

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

num_to_str_repr-0.0.4.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

num_to_str_repr-0.0.4-py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 3

Supported by

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