A numeric comparator package.
Reason this release was yanked:
This alpha version must be ignored.
Project description
number_comparator
A numeric comparator package.
Introduction
The number_comparator package can compare if a number is a:
- Prime
- Pair
- Periodic
Also, you can operate:
- Average from:
- Tuples
- Reverse numbers from:
- Integers
- Float
To obtain the package with pip, use one of this commands:
pip install number_comparator
pip install number_comparator_[version]_[plat].whl
pip install number_comparator_[version]_[plat].tar.gz
pip install number_comparator==[version]
pip install --upgrade number_comparator
Release notes
What's new in number_comparator 0.0.3 (Alpha 3)
- Minor bugs resolved
__version__
variable fixed- Some variables fixed at
number_comparator.data.first_prime
- Some operations fixed at
number_comparator.operations
:- Cleaner functions
- New MANIFEST.in includes:
- The
setup.py
- The license file
LICENSE
- The markdown file
README.md
- The
Using number_comparator functions
To call the number_comparator library, just type:
from number_comparator import *
isPair()
The function isPair(n)
takes a number and returns True if the number is a
pair or False if not. So, if you type:
print(isPair(20)) # Short number
print(isPair(15)) # Short number
print(isPair(1986031)) # Large number?
You'll get this output:
True
False
False
isPrime()
The prime numbers are numbers that can only be divided by 1 and themselves. To find if a number is prime, we used many functions:
- Check if a number is on a list of 168 prime numbers.
- If the number is larger, check if the termination is 1, 3, 7 or 9
Example: 3, 4, 7.
print(isPrime(3))
print(isPrime(4))
print(isPrime(7))
You must get:
True
False
True
NOTE: The function isPrime()
does not support negative numbers. You can operate them
by using the reverseNumber()
function.
reverseNumber()
The reverseNumber()
function converts a negative number to a positive number, and a
positive to a negative. The allowed data type is int()
.
print(reverseNumber(123))
print(reverseNumber(-123))
So, conversions must be:
Before | After |
---|---|
123 | -123 |
-123 | 123 |
To convert float numbers, use reverseFloat()
.
reverseFloat()
This function has the same function than reverseNumber()
, but taking a float number:
print(reverseNumber(1.23))
print(reverseNumber(-1.23))
isPeriodic()
In Python, periodic numbers are infinite float numbers. We are using this property to see if a number (int or float) is periodic.
For example, 10 / 3
returns a periodic float()
:
print(isPeriodic(10 / 3))
So you'll get the output:
True
average()
Take an average from a tuple or a group of numbers:
print(average(10, 7, 8, 9)) # As a multiple argument group
Getting the output:
8.5
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
Hashes for number_comparator-0.0.3a3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d7f4f380c436cf44478e578387ffb0ee661f9a8a3aca1337f64c6bed44e5e27 |
|
MD5 | 26dc003a3451c849726da37a841c1c2c |
|
BLAKE2b-256 | fe61a6e4dca87be223e3d3e3fc111886980b8375764ffd8b88ce2c31cd1ee262 |
Hashes for number_comparator-0.0.3a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d23d39308ee2f6c98b5a80fe161438e7c88e5141319a99402ecb8196cdb317b |
|
MD5 | 3f6460da2a7e249916756e9913b0086e |
|
BLAKE2b-256 | 3f3cb3b1fa08d9df687bed1e361f408522f2001a80763f811f3e937a598afa30 |