Stack/balancing_brackets.py
def is_balanced_string(st):
    """
    check string is balanced or not
    :param st:
    :return: boolean
    """
    left_param = "({["
    right_params = ")}]"

    s = Stack()

    for c in st:
        if c in left_param:
            s.push(c)
        elif c in right_params:
            if s.is_empty():
                return False
            rc = s.pop()
            if left_param.index(rc) != right_params.index(c):
                return False
    return s.is_empty()

    check string is balanced or not
    :param st:
    :return: boolean
    
check string is balanced or not
check string is balanced or not
def is_balanced_string(st):
    left_param = "({["
    right_params = ")}]"
    s = Stack()
    for c in st:
        if c in left_param:
            s.push(c)
        elif c in right_params:
            if s.is_empty():
                return False
            rc = s.pop()
            if left_param.index(rc) != right_params.index(c):
                return False
    return s.is_empty()
def is_balanced_string ( st ) : left_param = "({[" right_params = ")}]" s = Stack ( ) for c in st : if c in left_param : s . push ( c ) elif c in right_params : if s . is_empty ( ) : return False rc = s . pop ( ) if left_param . index ( rc ) != right_params . index ( c ) : return False return s . is_empty ( )
check string is balanced or not
check string is balanced or not
"""
    check string is balanced or not
    :param st:
    :return: boolean
    """
None
st
None