Package: number-comparator
number_comparatorA numeric comparator package, built by Diego Ramirez.IntroductionThe number_comparator package can compare if a number is a:PrimePairPeriodicMultiple of a specific number(new since version 0.0.4)Also, you can operate:Average from:TuplesLists(new since version 0.0.5)Reverse numbers from:IntegersFloatTo 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].tar.gz
pip install number_comparator==[version]
pip install --upgrade number_comparatorRelease notesWhat's new in number_comparator 0.0.5More accurate functionsSome operations corrected or added at functionisMultiple()New functionsaverageFromList(). View description to learn more.What's new in number_comparator 0.0.4New featuresVariable__license__New function:isMultiple()What's new in number_comparator 0.0.3Minor bugs resolved__version__variable fixedSome variables fixed atnumber_comparator.data.first_primeSome operations fixed atnumber_comparator.operations:Cleaner functionsNew MANIFEST.in includes:Thesetup.pyThe license fileLICENSEThe markdown fileREADME.mdUsing number_comparator functionsTo call the number_comparator library, just type:fromnumber_comparatorimport*isPair()The functionisPair(n)takes a number and returnsTrueif the number is a
pair orFalseif not. So, if you type:print(isPair(20))# Short numberprint(isPair(15))# Short numberprint(isPair(1986031))# Large number?You'll get this output:TrueFalseFalseisPrime()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 9Example: 3, 4, 7.print(isPrime(3))print(isPrime(4))print(isPrime(7))You must get:TrueFalseTrueNOTE:The functionisPrime()does not support negative numbers. You can convert them
by using thereverseNumber()function to operate it later.reverseNumber()ThereverseNumber()function converts a negative number to a positive number, and a
positive to a negative. The allowed data type isint().print(reverseNumber(123))print(reverseNumber(-123))So, conversions must be:BeforeAfter123-123-123123To convert float numbers, usereverseFloat().reverseFloat()This function has the same function thanreverseNumber(), 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 / 3returns a periodicfloat():print(isPeriodic(10/3))So you'll get the output:Trueaverage()Take an average from a tuple or a group of numbers:print(average(10,7,8,9))# As a multiple argument groupGetting the output:8.5isMultiple()Check if a number is a multiple of another number with syntax:isMultiple(a,b)Here, valueais the one to be checked, andbis the expected divisor. Taking
this explanation, check the example:print(isMultiple(15,5))print(isMultiple(35,4))And you must receive output:TrueFalseNOTE:FunctionisMultiple()only accepts integers. If you entercomplexorfloatnumbers, function will raise aTypeError. Check this example:print(isMultiple(complex(12,98),23.87))# A complex as 'a' and a float as 'b'Traceback (most recent call last):
 File .../.../.py, line ..., at <module>
     print(isMultiple(complex(12, 98), 23.87))
 File .../site-packages/number_comparator/comparisons.py, line 62, at isMultiple
         raise TypeError(
                        ^
TypeError: Expected int numbers, got values: 12, 98j | 23.87NOTE:At parameterb,isMultiple()only accepts numbers positive numbers
larger than 0. Also, when using 1 asb, you'll receive:warnings.warn(msg)

0298274hde5t43.UserWarning: When using 1 as divisor (arg 2), you will always get True.
We are returning True immediately to save variables.averageFromList()This function takes a list, extract the numbers, and return the average from them.Example:a=[10,complex(12,8),"dummy string",9.53,8,{"a":None}]print(averageFromList(a))9.17666666666666666At this example, the function ignored the string"dummy string", dictionary{"a": None}and the complexcomplex(12, 8).It only takes integers or float numbers.