Skip to main content

A Python package for converting numbers to text

Project description

NumberToWords Library Example

This example demonstrates how to use the aaqnumtowords library to convert numbers to words in both Persian and English languages.

Installation

First, you need to install the aaqnumtowords library:

pip install aaqnumtowords

Usage

Here is an example of using the library to convert numbers to words in both Persian and English.

from aaqnumtowords import NumberToWords

try:
    # Convert number to words in Persian
    converter_fa = NumberToWords(language='fa')
    print(converter_fa.number_to_words(123456789123456789123456789))  # Sample number in Persian
    
    # Convert number to words in English
    converter_en = NumberToWords(language='en')
    print(converter_en.number_to_words(123456789123456789123456789))  # Sample number in English
except ValueError as e:
    print(f"Error: {e}")

Explanation:

  • This code converts a very large number to words in both Persian and English.
  • If the input number is too large or invalid, a ValueError occurs, and an error message is displayed.

Output:

صد و بیست و سه کوادریلیون چهارصد و پنجاه و شش تریلیون هفتصد و هشتاد و نه بیلیون یکصد و بیست و سه میلیون چهارصد و پنجاه و شش هزار هفتصد و هشتاد و نه one hundred twenty-three quadrillion four hundred fifty-six trillion seven hundred eighty-nine billion one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine


Notes:

  • This code allows you to convert numbers into a readable format in different languages.
  • You can change the language of conversion as needed.

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

aaqnumtowords-0.0.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

aaqnumtowords-0.0.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file aaqnumtowords-0.0.3.tar.gz.

File metadata

  • Download URL: aaqnumtowords-0.0.3.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for aaqnumtowords-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ffc0836411e44e84006bb81e4dea6ba6a820842cff524457fe4a2b41c4fcedad
MD5 5c9d84eb2157c0ee456563a9f527c6a6
BLAKE2b-256 ac46622f76b297cc2fe1f74721e5a44807bd56a62e2b458bee49fa04992641ec

See more details on using hashes here.

File details

Details for the file aaqnumtowords-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: aaqnumtowords-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for aaqnumtowords-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 254510dad738ab79ce801a27a9e33ecc11e77a4aa33222935b9e1c019e5edbf9
MD5 2f66b379a2944faca8a94cf5882c4123
BLAKE2b-256 344088435ba14c311fb883084e7df154fe741491f5a10755bd4a742ffc1bdb26

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