Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Brackets by UFO665
openedBrackets = "{[("
dctBrackets = {"}": "{", "]": "[", ")": "("}
def checkio(expression):
lstBrackets = []
for char in expression:
if char in openedBrackets:
lstBrackets.append(char)
elif char in dctBrackets:
if lstBrackets and lstBrackets[-1] == dctBrackets[char]:
lstBrackets.pop()
else:
return False
return not lstBrackets
Feb. 28, 2016