Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Easy to code, hard to know what to code solution in Clear category for Brackets by leandroribeiro
def checkio(expression):
b1 = ('()')
b2 = ('[]')
b3 = ('{}')
#REMOVE EVERYTHING BUT BRACKETS
exp = ''.join([n for n in expression if n in b1+b2+b3])
#CHECK CLOSED BRACKETS AND REMOVE
while True:
exp = exp.replace(b1, '')
exp = exp.replace(b2, '')
exp = exp.replace(b3, '')
if len(exp) == 0:
return True
if b1 not in exp and b2 not in exp and b3 not in exp:
return False
July 18, 2017
Comments: