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
>>>
Metadata
Release files for hyphenfrac 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hyphenfrac-2.0.tar.gz | 3.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hyphenfrac-2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / hyphenfrac-2.0.tar.gz
| Download URL | hyphenfrac-2.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ac8666d50b2a36d2338c26d35c0215a525b64fa8ec6280af24984f68b850150
|
|
BLAKE2b-256 checksum How to use checksums |
75f5061c7dd4e81de235299bb28e0afa7f4be464f04739579a1052f634d91bf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Release files / hyphenfrac-2.0-py3-none-any.whl
| Download URL | hyphenfrac-2.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07c3dff74d45ddf7ef32720d8345d1df41765bac8f35ad17c7ab116510167480
|
|
BLAKE2b-256 checksum How to use checksums |
df49eaae205eb7945d1d2c502963e13cff8e9d6a88e404af13325bac85da781c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Security for hyphenfrac 2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.