Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by Nour
def checkio(exp):
s, d = [], {k: v for k, v in ['()', '{}', '[]']}
for t in exp:
if t in d.keys(): s.append(t)
elif t in d.values():
if s and t == d[s[-1]]: s.pop()
else: return False
return not bool(s)
May 28, 2018