A small Python library for working with common fractions.
Project description
ordinary-fractions
Небольшая библиотека Python для работы с обыкновенными дробями: нормализация, арифметика, сравнения, парсинг строк и вывод в смешанном виде.
Установка
Из PyPI
pip install ordinary-fractions
Локально из исходников
pip install -e .
Зависимости
- Runtime: нет внешних зависимостей
- Для тестов:
pytest
Установка зависимостей для разработки:
pip install -U pip
pip install -U pytest build twine
Использование
from ordinary_fractions import Fraction, parse_fraction, format_mixed
a = Fraction(1, 2)
b = Fraction(1, 3)
print(a + b)
print(a / b)
print(parse_fraction("2 1/3"))
print(format_mixed(Fraction(-7, 3)))
Запуск тестов
pytest -q
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
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 ordinary_fractions-0.1.0.tar.gz.
File metadata
- Download URL: ordinary_fractions-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbfa34c8957d2476bb3de502ab33b3f10818631f9c54c24a195e76928a3275f9
|
|
| MD5 |
6dabce0bf2851c453d24c5125b87f1b0
|
|
| BLAKE2b-256 |
e9b4e7f6e0835e82039dc06016d40a46ca4bf76292a8040d8e278b82e355ec53
|
File details
Details for the file ordinary_fractions-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ordinary_fractions-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63f9912a14541539796e4cf95dff9161a77ff792809ab93731245863344dacca
|
|
| MD5 |
b152ee99ec996eb431f2400d20bb588a
|
|
| BLAKE2b-256 |
a7efd101559a774dfa5f1964fad88b331ff1309301b7721ab4ba11f0726d12e2
|