Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by magda_kudrycka
# migrated from python 2.7
def checkio(expression):
nawiasy = {"{":"}", "(":")", "[":"]"}
stos = []
for i in expression:
if i in list(nawiasy.keys()):
stos.append(i)
elif i in list(nawiasy.values()):
if stos and i == nawiasy[stos[-1]]:
stos.pop()
else:
return False
return not bool(stos)
Nov. 27, 2016