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
-
From
converter
import the needed class (you haveIntegerConverter
andDecimalConverter
)from wordify.converter import IntegerConverter from wordify.converter import DecimalConverter
-
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)
-
Convert the number to its word representation using the
convert
method.int_word_representation = int_converter.convert() dec_word_representation = dec_converter.convert()
-
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
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 wordify-1.4.1.tar.gz
.
File metadata
- Download URL: wordify-1.4.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47d851349e94fe78737ee777d6fb2a08156ea1dc56928b8d4707b81d15389a16 |
|
MD5 | 2a491524506c834d8fe3c56d290d232a |
|
BLAKE2b-256 | 7138caf68fa3ce72736d8620cd597f4182a6463776984bd1121e006b8d1c6ebd |
File details
Details for the file wordify-1.4.1-py3-none-any.whl
.
File metadata
- Download URL: wordify-1.4.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca42228b1b8e08d2f2afeeebab5aee9e4842e416c9251acd1743f82a14ea9486 |
|
MD5 | 664f78cebfdb65b892e9d45442f4df27 |
|
BLAKE2b-256 | b3085d2dd090e588917707549511bdbf8f598f6b15e77a301dca1fa7c5df56e6 |