From ef0eeb8d75fc20fb96b0a5abb5244925c61f0357 Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 10:31:36 +0300 Subject: [PATCH 1/8] .\number.py --- number.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/number.py b/number.py index 55bf143..2d49a9d 100644 --- a/number.py +++ b/number.py @@ -1,5 +1,11 @@ class Number: def __init__(self,num): - pass + self.num = num - # Create methods of Number class \ No newline at end of file + # Create methods of Number class + + def data_taype(self) ->type: + """ + function that returns the type of the number + """ + return (self.num) From d19134f08d9c890f3942a475406280b324bbca76 Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 10:34:33 +0300 Subject: [PATCH 2/8] .\number.py --- number.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/number.py b/number.py index 2d49a9d..6862ef7 100644 --- a/number.py +++ b/number.py @@ -9,3 +9,9 @@ def data_taype(self) ->type: function that returns the type of the number """ return (self.num) + + def number_len(self) ->len: + """ + a function that returns the length of a number + """ + return len(str(self.num)) \ No newline at end of file From 002512f3bb5532d81c53d88cee4765d2653139a1 Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 10:39:52 +0300 Subject: [PATCH 3/8] .\number.py --- number.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/number.py b/number.py index 6862ef7..254e1bb 100644 --- a/number.py +++ b/number.py @@ -8,10 +8,17 @@ def data_taype(self) ->type: """ function that returns the type of the number """ - return (self.num) + return type(self.num) def number_len(self) ->len: """ a function that returns the length of a number """ - return len(str(self.num)) \ No newline at end of file + return len(str(self.num)) + + def is_positive(self) ->bool: + """ + function that checks the positivity of a number + """ + if self.num > 0: + return True \ No newline at end of file From a686331488f5a21a6f509db1e40c652548c74068 Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 10:45:10 +0300 Subject: [PATCH 4/8] .\number.py --- number.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/number.py b/number.py index 254e1bb..45741cc 100644 --- a/number.py +++ b/number.py @@ -21,4 +21,11 @@ def is_positive(self) ->bool: function that checks the positivity of a number """ if self.num > 0: + return True + + def is_negative(self) ->bool: + """ + function that checks the negativity of a number + """ + if self.num < 0: return True \ No newline at end of file From a41b7ce605d10ee0022a72076b5b8d9ccd8f32dd Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 10:52:55 +0300 Subject: [PATCH 5/8] .\number.py --- number.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/number.py b/number.py index 45741cc..0247e0d 100644 --- a/number.py +++ b/number.py @@ -28,4 +28,10 @@ def is_negative(self) ->bool: function that checks the negativity of a number """ if self.num < 0: + return True + + def is_zero(self) -> bool: + """checking that the number is zero + """ + if self.num == 0: return True \ No newline at end of file From fadaab0fa35fd799f87537901b209420545b26e2 Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 11:00:26 +0300 Subject: [PATCH 6/8] .\number.py --- number.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/number.py b/number.py index 0247e0d..8525a16 100644 --- a/number.py +++ b/number.py @@ -1,3 +1,6 @@ +import re + + class Number: def __init__(self,num): self.num = num @@ -34,4 +37,13 @@ def is_zero(self) -> bool: """checking that the number is zero """ if self.num == 0: - return True \ No newline at end of file + return True + + def is_even(self) ->bool: + """ + a function that determines the evenness of a number + """ + if self.num % 2 == 0: + return True + else: + return False \ No newline at end of file From 03351d94cbfef92f71933305971a6f845247f9d7 Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 11:06:50 +0300 Subject: [PATCH 7/8] .\number.py --- number.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/number.py b/number.py index 8525a16..b80254f 100644 --- a/number.py +++ b/number.py @@ -45,5 +45,14 @@ def is_even(self) ->bool: """ if self.num % 2 == 0: return True + else: + return False + + def is_odd(self) ->bool: + """ + a function that determines the oddness of a number + """ + if self.num % 2 == 1: + return True else: return False \ No newline at end of file From 554f36bd55a8384cf9684e69aa6f185991fec1ec Mon Sep 17 00:00:00 2001 From: tajriba Date: Sat, 30 Jul 2022 11:34:58 +0300 Subject: [PATCH 8/8] .\number.py --- number.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/number.py b/number.py index b80254f..215ea75 100644 --- a/number.py +++ b/number.py @@ -1,4 +1,4 @@ -import re +import re,math class Number: @@ -55,4 +55,11 @@ def is_odd(self) ->bool: if self.num % 2 == 1: return True else: - return False \ No newline at end of file + return False + + def is_prime(self): + """a function that checks the integrity of a number""" + for i in range(2, math.sqrt(self.num) +1): + if self.num % i == 0: + return False + return True # if self.num is prime return True ,otherwise return False \ No newline at end of file