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
you can check this code. This code don't use stack operations.
def matched(s): count = 0 for i in s: if i is "(": count += 1 elif i is ")": if count != 0: count -= 1 else: return (False) if count == 0: return (True) else: return (False)