input: def combine_parentheses(lst):
      '''
      You are provided with a list containing two strings, each comprising only
      opening '(' and closing ')' parentheses.
      Your task is to determine whether it's possible to concatenate these two strings
      in such an order that the resulting string becomes valid.
      A string is deemed valid if and only if the parentheses within it are balanced.
      For example, the string '(())()' is valid, while '())' is not.
      Return 'Yes' if a valid formation is possible, and 'No' otherwise.
  
      Examples:
      combine_parentheses(['()(', ')']) == 'Yes'
      combine_parentheses([')', ')']) == 'No'
      '''
output:     def is_valid(s):
          balance = 0
          for char in s:
              if char == '(':
                  balance += 1
              else:
                  balance -= 1
              if balance < 0:
                  return False
          return balance == 0
  
      s1, s2 = lst
      if is_valid(s1 + s2) or is_valid(s2 + s1):
          return 'Yes'
      else:
          return 'No'