+ 3
Is there anything wrong here?
I am trying to complete a project named Balanced Parenthesis (You cab find it in Python Data Structures). The output shows me that everything is ok, except the last test case (It is hidden). How can I know where did I wrong? This is my code for the project: def balanced(): #your code goes here bal = str(input()) for i in range(len(bal)): if bal.count("(") == bal.count(")"): return True else: return False print(balanced())
2 Answers
+ 5
Some wrong cases:
)))(((
)(((()))
)(
())(
All of the above is True according to your program.
+ 2
CarrieForle Thank you very much!