A lightweight Python utility library with math, string, and list helpers.
Project description
pyutil-kit
A lightweight Python utility library with three modules covering math, string, and list operations.
Installation
pip install pyutil-kit
Modules
mathutils
| Function | Description |
|---|---|
mean(numbers) |
Arithmetic mean of a list |
is_prime(n) |
Check if a number is prime |
factorial(n) |
Factorial of a non-negative integer |
clamp(value, min, max) |
Clamp a number within a range |
percentage(part, total) |
Compute what % part is of total |
strutils
| Function | Description |
|---|---|
reverse(text) |
Reverse a string |
count_words(text) |
Count words in a string |
is_palindrome(text) |
Check if string is a palindrome |
truncate(text, max_length) |
Truncate string with suffix |
slug(text) |
Convert string to URL-friendly slug |
listutils
| Function | Description |
|---|---|
flatten(nested) |
Flatten a nested list |
chunk(lst, size) |
Split list into chunks |
unique(lst) |
Remove duplicates, preserve order |
frequency(lst) |
Count occurrences of each element |
Usage
from pyutil_kit import mean, is_prime, is_palindrome, flatten
print(mean([10, 20, 30])) # 20.0
print(is_prime(17)) # True
print(is_palindrome("racecar")) # True
print(flatten([1, [2, [3, 4]]])) # [1, 2, 3, 4]
License
MIT
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 pyutil_kit_madiha-1.0.0.tar.gz.
File metadata
- Download URL: pyutil_kit_madiha-1.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db4b4d08571ec5ccfce8cc88b5e8dc1582e73cbbd2610368fc60d029c21c589b
|
|
| MD5 |
2a5059cd7736393605bdd079a89d5bb8
|
|
| BLAKE2b-256 |
f9f9df48ab122c13c6dc595eec0568a76efec2048e34e786003a4d1b23be7407
|
File details
Details for the file pyutil_kit_madiha-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyutil_kit_madiha-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16c9bd5b531be4cfb78a32364cbbc84396c211dca8abf3ba556feb55358b12b9
|
|
| MD5 |
346afd448400bdcc77c56b4f3fcabce0
|
|
| BLAKE2b-256 |
1cca63504572a46fed8d0e6ccb59809fc1ae9c199ee4f246ea70a223b72d8484
|