Equilibrando la parantis Python
o=['[','{','(']
c=[']','}',')']
def check(s):
a=[]
for i in s:
if i in o:
a.append(i)
elif i in c:
pos=c.index(i)
if((len(a)>0)and(o[pos]==a[len(a)-1])):
a.pop()
else:
return "Unbalaced"
if len(a)==0:
return "bal"
else:
return "Unbal"
s='{{[])}}'
string=check(s)
print(string)
Worrisome Worm