My code failed to iterate on somesection of the code
Question: I have this python function code that suppose to balance up the number of
"bracket" in any parameter supply. Though, it work well with require problem
in the exercise but when the parameter contain 4 or more bracket the function
failed to balance it up. below is the code.

    
    
    def closedBracket(string_input):
       import  unicodedata, re
       left_bracket = re.compile('[\u0028]')
       right_bracket = re.compile('[\u0029]')
       left_bracket = len(left_bracket.findall(string_input))
       right_bracket = len(right_bracket.findall(string_input))
       if left_bracket > right_bracket:
          # Remove  the leftmost bracket or add one last right bracket
          count = 0
          largest_bracket = (left_bracket - right_bracket)
          while count <= largest_bracket:
             final_string = str(string_input) + '\u0029'
             count += 1
          print('False', final_string)
       elif left_bracket < right_bracket:
          # Remove the last Rightmost Bracket or add another leftmost bracket
          count = 0
          largest_bracket = (right_bracket - left_bracket)
          while count <= largest_bracket:
             final_string = '\u0028' + str(string_input)
             count += 1
          print('False', final_string)
    
       else:
         print('True')
    
    closedBracket("(5+3)*2)")
    
    The output is "False ((5+3)*2)"
    

The above function work on the supply parameter, but when I run it on the
below supply parameter, the output is wrong, so I need advise on what to do.

    
    
    def closedBracket(string_input):
       import  unicodedata, re
       left_bracket = re.compile('[\u0028]')
       right_bracket = re.compile('[\u0029]')
       left_bracket = len(left_bracket.findall(string_input))
       right_bracket = len(right_bracket.findall(string_input))
       if left_bracket > right_bracket:
          # Remove  the leftmost bracket or add one last right bracket
          count = 0
          largest_bracket = (left_bracket - right_bracket)
          while count <= largest_bracket:
             final_string = str(string_input) + '\u0029'
             count += 1
          print('False', final_string)
       elif left_bracket < right_bracket:
          # Remove the last Rightmost Bracket or add another leftmost bracket
          count = 0
          largest_bracket = (right_bracket - left_bracket)
          while count <= largest_bracket:
             final_string = '\u0028' + str(string_input)
             count += 1
          print('False', final_string)
    
       else:
         print('True')
    
    closedBracket("((((5+3)*2)")
    
    The output is "False ((((5+3)*2))" and this is wrong
    


Answer: In the cycle you have this line

    
    
    final_string = str(string_input) + '\u0029'
    

Which means that each time you take _input string_ and add `)` to it. So no
matter how many iterations you do `final_string` will always be equal to
`input_string` joined with `)`.

