hyphenfrac
A basic utility designed to prettify and visualize fractions.
Usage
Prerequisites
- A terminal accepting ANSI codes
Displaying Fractions
Displaying a prettified fraction from a number:
>>> import hyphenfrac, random
>>> hyphenfrac.visualize_number(random.randint(1, 100)/random.randint(1, 100))
20
-- + 1
49
>>>
You may also assign this value to a variable:
>>> import hyphenfrac
>>> foo = hyphenfrac.make_pretty(1, 10)
>>> print(foo)
1
--
10
>>>
You can optionally use a dash instead of a hyphen-minus character for a vinculum:
>>> import hyphenfrac
>>> hyphenfrac.visualize("ln(x) - ln(y)", "x - y", hyphen=False)
ln(x) - ln(y)
―――――――――――――
x - y
>>>
Creating Fractions
Fractions could also be used as their own object:
>>> from hyphenfrac import Fraction
>>> myFrac = Fraction(numerator="Vd", denominator="CL", operation="", whole="ln(2)", hyphen=False)
>>> myFrac.display()
Vd
―― ln(2)
CL
>>> isinstance(myFrac, Fraction)
True
>>>
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hyphenfrac-2.0.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hyphenfrac-2.0.tar.gz.
File metadata
- Download URL: hyphenfrac-2.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ac8666d50b2a36d2338c26d35c0215a525b64fa8ec6280af24984f68b850150
|
|
| MD5 |
3be6f539f594eba5bd895b7c76ff3484
|
|
| BLAKE2b-256 |
75f5061c7dd4e81de235299bb28e0afa7f4be464f04739579a1052f634d91bf3
|
File details
Details for the file hyphenfrac-2.0-py3-none-any.whl.
File metadata
- Download URL: hyphenfrac-2.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07c3dff74d45ddf7ef32720d8345d1df41765bac8f35ad17c7ab116510167480
|
|
| MD5 |
a0057c8b66dd30bce96d4fa65d448568
|
|
| BLAKE2b-256 |
df49eaae205eb7945d1d2c502963e13cff8e9d6a88e404af13325bac85da781c
|