@@ -12,7 +12,10 @@ def isDecimal(self, value: float) -> bool:
1212
1313 def isDivisibleBy (self , number : int , divisor : int ) -> bool :
1414 """ check if the number is divisible by divisor or not """
15- return self .isvalidNumber (number ) and self .isvalidNumber (divisor ) and divisor != 0 and number % divisor == 0
15+ return (self .isvalidNumber (number ) and
16+ self .isvalidNumber (divisor ) and
17+ divisor != 0 and
18+ number % divisor == 0 )
1619
1720 def truncate (self , value : float , digits : int ) -> float :
1821 """ truncate the float value """
@@ -59,24 +62,34 @@ def isNonZero(self, value):
5962
6063 def isGreaterThan (self , value , other ):
6164 """ check if the value is greater than other or not """
62- return self .isvalidNumber (value ) and self .isvalidNumber (other ) and value > other
65+ return (self .isvalidNumber (value ) and
66+ self .isvalidNumber (other ) and
67+ value > other )
6368
6469 def isGreaterThanOrEqual (self , value , other ):
6570 """ check if the value is greater than or equal to other or not """
66- return self .isvalidNumber (value ) and self .isvalidNumber (other ) and value >= other
71+ return (self .isvalidNumber (value ) and
72+ self .isvalidNumber (other ) and
73+ value >= other )
6774
6875 def isLessThan (self , value , other ):
6976 """ check if the value is less than other or not """
70- return self .isvalidNumber (value ) and self .isvalidNumber (other ) and value < other
77+ return (self .isvalidNumber (value ) and
78+ self .isvalidNumber (other ) and
79+ value < other )
7180
7281 def isLessThanOrEqual (self , value , other ):
7382 """ check if the value is less than or equal to other or not """
74- return self .isvalidNumber (value ) and self .isvalidNumber (other ) and value <= other
83+ return (self .isvalidNumber (value ) and
84+ self .isvalidNumber (other ) and
85+ value <= other )
7586
7687 def isBetween (self , value , min_value , max_value ):
7788 """ check if the value is between min_value and max_value or not """
78- return self .isvalidNumber (value ) and self .isvalidNumber (min_value ) and \
79- self .isvalidNumber (max_value ) and min_value <= value <= max_value
89+ return (self .isvalidNumber (value ) and
90+ self .isvalidNumber (min_value ) and
91+ self .isvalidNumber (max_value ) and
92+ min_value <= value <= max_value )
8093
8194 def isPrime (self , value ) -> bool :
8295 """ check if the value is a prime number or not """
@@ -86,27 +99,29 @@ def isPrime(self, value) -> bool:
8699 if value % i == 0 :
87100 return False
88101 return True
89-
102+
90103 def isEven (self , value ) -> bool :
91104 """ check if the value is even or not """
92105 return self .isvalidNumber (value ) and value % 2 == 0
93-
106+
94107 def isOdd (self , value ) -> bool :
95108 """ check if the value is odd or not """
96109 return self .isvalidNumber (value ) and value % 2 != 0
97-
110+
98111 def isMultipleOf (self , value , multiple ) -> bool :
99112 """ check if the value is a multiple of another number """
100- if not self .isvalidNumber (value ) or not self .isvalidNumber (multiple ) or multiple == 0 :
113+ if (not self .isvalidNumber (value ) or
114+ not self .isvalidNumber (multiple ) or
115+ multiple == 0 ):
101116 return False
102117 return value % multiple == 0
103-
118+
104119 def isSquare (self , value ) -> bool :
105120 """ Check if the value is a perfect square or not """
106121 if not self .isvalidNumber (value ):
107122 return False
108123 if value < 0 :
109- return False # Negative numbers cannot be perfect squares.
124+ return False
110125 square_root = round (value ** 0.5 )
111126 return square_root ** 2 == value
112127
0 commit comments