What's wrong with this?
Program of Balanced Parentheses open=tuple('({[') close=tuple(')}]') class Stack: def __init__(self): self.items = [] def is_empty(self): return self.items == [] def push(self, item): self.items.insert(0, item) def pop(self): return self.items.pop(0) def print_stack(self): print(self.items) def balanced(expression): l=Stack() for i in expression: if i in open: l.push(i) elif i in close: if l.is_empty()==False: l.pop() else: continue else: continue if l.is_empty(): return True else: return False print(balanced(input()))