I am a Python newbie and I came across this exercise of checking whether or not the simple brackets \"(\", \")\" in a given string are matched evenly.
I have seen ex
foo1="()()())(" def bracket(foo1): count = 0 for i in foo1: if i == "(": count += 1 else: if count==0 and i ==")": return False count -= 1 if count == 0: return True else: return False bracket(foo1)