From 9767e0039d545817ea67b510d4f3337d895746c7 Mon Sep 17 00:00:00 2001 From: chabisik Date: Sat, 26 Mar 2022 19:29:47 +0100 Subject: [PATCH] Adding minor changes --- CTPLICA/comproject.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/CTPLICA/comproject.py b/CTPLICA/comproject.py index 6c19b0c..d4c6408 100644 --- a/CTPLICA/comproject.py +++ b/CTPLICA/comproject.py @@ -43,13 +43,13 @@ def overlap(arg1: str, arg2: str) -> str: arg2_decimal_part = arg2_decimal_part + '0'*(max_decimal_part_size-len(arg2_decimal_part)) #--------- if not(arg1_is_negative) and arg2_is_negative: #arg1 positive - arg2 negative - overlap_result += "1" + overlap_result += '1' elif not(arg1_is_negative) and not(arg2_is_negative): #arg1 positive - arg2 positive - overlap_result += "2" + overlap_result += '2' elif arg1_is_negative and not(arg2_is_negative): #arg1 negative - arg2 positive - overlap_result += "3" + overlap_result += '3' elif arg1_is_negative and arg2_is_negative: #arg1 negative - arg2 negative - overlap_result += "4" + overlap_result += '4' #--------- for index in range(max_integer_part_size): overlap_result += arg1_integer_part[index] @@ -72,13 +72,13 @@ def unoverlap(arg: str) -> Sequence[str]: else: arg_is_full_integer = False except: pass#nothing to do - if arg_integer_part[0]=="1": #arg1 must be positive - arg2 must be negative + if arg_integer_part[0]=='1': #arg1 must be positive - arg2 must be negative arg2 += '-' - elif arg_integer_part[0]=="2": #arg1 must be positive - arg2 must be positive + elif arg_integer_part[0]=='2': #arg1 must be positive - arg2 must be positive pass - elif arg_integer_part[0]=="3": #arg1 must be negative - arg2 must be positive + elif arg_integer_part[0]=='3': #arg1 must be negative - arg2 must be positive arg1 += '-' - elif arg_integer_part[0]=="4": #arg1 must be negative - arg2 must be negative + elif arg_integer_part[0]=='4': #arg1 must be negative - arg2 must be negative arg1 += '-' arg2 += '-' arg_integer_part = arg_integer_part[1:] #ignoring signs' digit now as it's already used @@ -242,7 +242,7 @@ def sb_substract(arg1: str, arg2: str) -> str: return result -def sb_multiply(arg1: str, arg2: str) -> bool: +def sb_multiply(arg1: str, arg2: str) -> str: # transform arg1 to string if not already in string and test if it's a full integer (without decimal part or decimal part equals zero) arg1_as_string = str(arg1) arg1_integer_part = arg1_as_string @@ -314,6 +314,9 @@ def good_format(result: str) -> str: while '.' in result and result.endswith('0'): result = result[:-1] return result +def sb_division(arg1: str, arg2: str) -> str: + pass + if __name__=='__main__': #print("add", sb_addition("2222222222222222222222222222222222222222.55", "2.55") )