Skip to main content

A Python module to convert numerical values into their word representation.

Project description

wordify

Wordify is a Python class that converts a given number into its word representation. It can convert numbers up to centillions.

Usage

  1. From converter import the needed class (you have IntegerConverter and DecimalConverter)

    from wordify.converter import IntegerConverter
    from wordify.converter import DecimalConverter
    
  2. Create an instance of the Converter class by providing a number to be converted.

    int_number = 12345
    int_converter = IntegerConverter(int_number)
    dec_number = 123.45
    dec_converter = DecimalConverter(dec_number)
    
  3. Convert the number to its word representation using the convert method.

    int_word_representation = int_converter.convert()
    dec_word_representation = dec_converter.convert()
    
  4. Print the word representation.

     print(int_word_representation)  # output: twelve thousand and three hundred forty five
     print(dec_word_representation)  # output: one hundred twenty three point four five
    

Example

from converter import IntegerConverter

# Create a Converter instance with a number
number = 12345
converter = IntegerConverter(number)

# Convert the number to words
word_representation = converter.convert()

# Print the word representation
print(word_representation)   # output: twelve thousand and three hundred forty five

Customization

You can set a new number for conversion using the set_number method.

converter.set_number(98765)

After setting the new number, you need to call the convert method again to obtain the word representation.

License

The code in this repository is licensed under the MIT License.

You can find the full text of the license in the LICENSE file. For more information, please visit the repository on GitHub.

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

wordify-1.4.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

wordify-1.4.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file wordify-1.4.0.tar.gz.

File metadata

  • Download URL: wordify-1.4.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for wordify-1.4.0.tar.gz
Algorithm Hash digest
SHA256 b19f3de66a5fe497d656fe214851d97de3ed019ed85fba7287d4a7b57ffdd591
MD5 f4def9471a09e8237a0d84a0f88d1f05
BLAKE2b-256 f56568a9997298df4c1425c9a57a93323627382371b6620f77c9e81fa467ae9a

See more details on using hashes here.

File details

Details for the file wordify-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: wordify-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for wordify-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96538883c08d5efa8e42fc18510c9a5c17cf155de43063ec39db0346855b8cbe
MD5 a926f57dd89d4faae015c7b5c38fceed
BLAKE2b-256 a8e1aa79dd490597e9aedb9027e7ea78fb918bd40cc837cfe4cefde89c41d0ff

See more details on using hashes here.

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