Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def balanced_brackets(brac):
- s = Stack()
- brackets = '(' ')' '<' '>'
- while not brac.is_empty():
- a = s.peak(brac)
- if not a == brackets:
- s.pop(a)
- elif a == '(' and ')':
- s.pop(a)
- elif a == '<' and '>':
- s.pop(a)
- else:
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement