• How to chath the error

Question related to mission Brackets

 
    def checkio(expression):
BRACKETS=["(","[","{",")","}","]"]
TWO_BRACKETS=["()", "{}", "[]"]
brck=[]
k=0
"""for i in expression:
    if (i in BRACKETS):
        brck.append(i)"""
brck=list(expression[496:504])
print(brck)
if len(brck)%2==0:
    i=0

    while brck:
        print ("i=",i,brck[i],brck[i+1] )

        if brck[i]+brck[i+1] in TWO_BRACKETS:
            brck.remove(brck[i+1])
            print ('remove1=',brck, i)
            brck.remove(brck[i])
            print ('remove2=',brck)
            i=0
            print(i,brck)
        else:
            if i<(len(brck)-2):
                i+=1
            else:
                print("False")
                return False
    else:
        print("True")
        return True
else: 
    print("False")
    return False

checkio("([{([{(({{{([{[[[{[([((([(({[[[[(([{([[{[[{{({[([([[{((([{{{[{[[([(({((({[((({(([({{{[([({([[{({{[[{[[([[{([{[([([([(([(([({((({(((((({[({([[{[{[([({[[({[[([[[[{{(([{{[{[{{[{[{{[[((((([{[[{({([[[[[({((({{[[{[[[[[({(([[{[{[[{{[{[{([([{{{{{{{((([[{{((({[[[[[([(((({{({{[([[[(({{{([[{{{([[{([({[({[({(([[([{[[[(([[{[{{{{({[[[{[{{([{({[({{({([((([(([{({(({[[([([([{{[([{[[{([({[{({[[(([((({(([[({{({[{({{{[{({{({[({{{{(([{(([(({({[{{[({[({([[[[(([[{(([{[{({(((([[[(([([{[{{(((([[{({{([[{(((((({[[{{(({([[]])}))}}]]}))))))}]])}})}]]))))}}]}])]))]]]))))})}]}]))}]]))]]]])})]})]}}]})}))]))}]))}}}})]})}})}]}}})}]})}})]]))})))]))]]})}]})])}]]}])]}}])])])]]}))})}]))])))])})}})]})}])}}]}]]]})}}}}]}]]))]]]}])]]))})]})]})])}]])}}}]])}}}))]]])]}})}}))))])]]]]]})))}}]])))}}}}}}}])])}]}]}}]]}]}]]))})]]]]]}]]}})))})]]]]])})}]]}])))))]]}}]}]}}]}]}}]))}}]]]])]]})]]})])]}]}]])})]}))))))})))})]))]))])])])]}])}]])]]}]]}})}]])})])]}}})]))})))]})))}))])]]}]}}}])))}]])])]})}}]]}]])}]))]]]]}))])))])]}]]]}])}}}))}])}])")