Here are my test cases ->
{(<[testdata])>}
-> false
{just{test<of>Unbalanced}String')
-> False
{(<[ABalancedExample]>)}
-> True
opening = ['[','(','<','{']
closing = [']',')','>','}']
My code doesn't work for {(<[testdata])>} as the order of the parentheses is not taken care of
def check(str):
count = 0
if not str:
return None
for i in str:
if i in opening:
count += 1
elif i in closing:
count -= 1
if count < 0:
return False
return count == 0