+ 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())

15th Feb 2021, 2:09 PM
ekkwnsnsnwkkqwknnq
ekkwnsnsnwkkqwknnq - avatar
2 Respuestas
+ 5
Some wrong cases: )))((( )(((())) )( ())( All of the above is True according to your program.
15th Feb 2021, 2:11 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 2
CarrieForle Thank you very much!
15th Feb 2021, 2:13 PM
ekkwnsnsnwkkqwknnq
ekkwnsnsnwkkqwknnq - avatar