I would like to give some feedback about ...
From: https://py.checkio.org/mission/brackets/solve/
HTTP_USER_AGENT:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
open_brackets="([{"
close_brackets=")]}"
open_bracket=[]
close_bracket=[]
def checkio(expression):
for b in expression:
if b in open_brackets:
position_open=open_brackets.index(b)
open_bracket.append(position_open)
print(b)
print (open_bracket)
if b in close_brackets:
position_close=close_brackets.index(b)
close_bracket.append(position_close)
print(b)
print (close_bracket)
if open_bracket==close_bracket[::-1]:
return True
else:
return False
#print(checkio("{[(3+1)+2]+}"))
In my Python shell when I print the result is True but in CheckiO the result is False. I've went through the whole thing several times and have no clue.
Created at: 2016/12/05 22:29; Updated at: 2016/12/05 22:29