Python implementation of is-x library
Project description
is-x-py
Python implementation of is-x, a flexible and fun library for number comparison and manipulation.
Installation
pip install is-x-py
Basic Usage
from is_x import Is
# Set a target number
Is(20).set_X()
# Compare other numbers
Is(15).plus(5).is_X() # True (15 + 5 = 20)
Is(40).divided_by(2).is_X() # True (40 / 2 = 20)
# Check properties of target number
Is.X.is_even() # True (20 is even)
Is.X.is_prime() # False (20 is not prime)
Features
Math Operations
# Basic Math
Is(15).plus(5).is_X() # True (15 + 5 = 20)
Is(25).minus(5).is_X() # True (25 - 5 = 20)
Is(10).times(2).is_X() # True (10 * 2 = 20)
Is(40).divided_by(2).is_X() # True (40 / 2 = 20)
# Chain operations
Is(10).plus(5).times(2).minus(10).is_X() # True (10 + 5 = 15, *2 = 30, -10 = 20)
# Advanced Math
Is(4).squared() # squares the number
Is(400).square_root() # square root
Is(2).power(4) # raises to power
Is(8000).root(3) # nth root
Is(100).modulo(80) # modulo operation
Is(-20).absolute() # absolute value
Is(3).factorial() # factorial
Approximate Comparisons
# Different levels of approximation
Is(19.9).roughly.is_X() # True (within 0.2 units)
Is(19.5).approximately.is_X() # True (within 0.5 units)
Is(18).within(3).of.is_X() # True (within 3 units)
Number Properties
Is.X.is_perfect_square() # checks if perfect square
Is.X.is_prime() # checks if prime
Is.X.is_fibonacci() # checks if Fibonacci number
Is.X.is_even() # checks if even
Is.X.is_odd() # checks if odd
Is.X.is_divisible_by(4) # checks divisibility
Is.X.has_factors() # returns all factors
Is.X.is_multiple_of(5) # checks if multiple
Fun Checks
Is.X.is_current_hour() # compares with current hour
Is.X.is_current_year() # compares with current year
Is.X.is_answer_to_life() # checks if 42
Is.X.is_unlucky() # checks if 13
Is.X.is_dice_roll() # checks if valid dice number (1-6)
Is.X.is_card_number() # checks if valid card number (1-13)
Is.X.is_pokemon_number() # checks if valid Pokémon number (1-898)
Technical Checks
Is.X.is_port() # checks if valid port number (0-65535)
Is.X.is_http_status() # checks if valid HTTP status code
Is.X.is_rgb_value() # checks if valid RGB value (0-255)
Is.X.is_version() # checks if valid version number
Is.X.is_phone_number() # checks if valid phone number format
Error Handling
The library includes proper error handling for:
- Division by zero
- Invalid square roots (negative numbers)
- Invalid factorials (negative numbers or non-integers)
- Invalid root calculations
- Invalid phone numbers
- Out of range values
Related Packages
Check out our multi-language installer:
npm install -g is-x-installer
Links
- JavaScript implementation: is-x-js
- Installer implementation: is-x-installer
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
is_x_py-0.0.1.tar.gz
(3.9 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 is_x_py-0.0.1.tar.gz.
File metadata
- Download URL: is_x_py-0.0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e8be940a86afe7105803e74c6d58ca3e025cd59829c38e5d34b06a5ec852318
|
|
| MD5 |
d5704956f51f32ebd97d30d701e3db23
|
|
| BLAKE2b-256 |
53760d712c21f16454e678665a065b03de93f6ce4ebd0ad4a74a2042b28ec081
|
File details
Details for the file is_x_py-0.0.1-py3-none-any.whl.
File metadata
- Download URL: is_x_py-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed0336e8f7943359f182190a9dbb2fdad589fea0096c2148a2b6eab9ae0bc247
|
|
| MD5 |
c0c39004ccdef7c852d2a74eacf928af
|
|
| BLAKE2b-256 |
f722758c92e7326b75771515ca46da93d949f0e4ce33610a6e04ada1310dbb38
|