Write a function balanced(s) that given a string containing only open and closed parenthesis, returns True if the string contains well-formed parenthesis combination and False otherwise
Observation
Only the function is needed. If you have a test main program, embed it inside a block if __name__=="__main__" :
>>> balanced('(())()()') True >>> balanced('(()()))(') False >>> balanced('())()') False >>> balanced('((()') False