A Python utility library with mathematical and string processing functions
Project description
Farhan
A Python utility library with mathematical and string processing functions.
Installation
pip install farhan
Features
Math Utilities (farhan.math_utils)
| Function | Description |
|---|---|
factorial(n) |
Calculate factorial of a number |
is_prime(n) |
Check if a number is prime |
fibonacci(n) |
Generate first n Fibonacci numbers |
gcd(a, b) |
Calculate greatest common divisor |
String Utilities (farhan.string_utils)
| Function | Description |
|---|---|
reverse_string(s) |
Reverse a string |
is_palindrome(s) |
Check if string is a palindrome |
word_count(s) |
Count words in a string |
capitalize_words(s) |
Capitalize first letter of each word |
Usage
Math Utilities
from farhan import factorial, is_prime, fibonacci, gcd
# Calculate factorial
print(factorial(5)) # Output: 120
# Check if prime
print(is_prime(17)) # Output: True
# Generate Fibonacci sequence
print(fibonacci(7)) # Output: [0, 1, 1, 2, 3, 5, 8]
# Find GCD
print(gcd(48, 18)) # Output: 6
String Utilities
from farhan import reverse_string, is_palindrome, word_count, capitalize_words
# Reverse a string
print(reverse_string("hello")) # Output: "olleh"
# Check palindrome
print(is_palindrome("radar")) # Output: True
# Count words
print(word_count("Hello world")) # Output: 2
# Capitalize words
print(capitalize_words("hello world")) # Output: "Hello World"
License
MIT License - see LICENSE for details.
Author
Farhan
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
farhan-0.1.0.tar.gz
(5.3 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 farhan-0.1.0.tar.gz.
File metadata
- Download URL: farhan-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84f7fad32f663c5cdc44391f28d2a8880e44e93c69cd1c82ce57d05000f5fa7e
|
|
| MD5 |
b8f7e293dbf57fd400958b229311fc3c
|
|
| BLAKE2b-256 |
8a58ce163c67a23e4d1b0b83ef025d650716a65ba78f6112c2eddf54d8f8c56f
|
File details
Details for the file farhan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: farhan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7929b80a9f487453c795a4e223a2a3a67429d8e69076137805816c9004edf0dd
|
|
| MD5 |
4a23ce2e70b938a1dce6c6743a40c773
|
|
| BLAKE2b-256 |
12ba6c8d14a983df3983ae85dc93d0d24b0e51a1f11a2d4521b8eea1edcf6bc5
|