+ 1

I don't know why but the below code for balancing parenthesis is showing "False" for input "(())". Suggest me what's wrong.

https://code.sololearn.com/cq7R7jCdH09C/?ref=app

1st May 2021, 10:17 AM
Harsh Mandwariya
Harsh Mandwariya - avatar
4 Réponses
+ 2
Change the break into a continue in line 24
1st May 2021, 10:28 AM
Hape
Hape - avatar
+ 3
Also, FYI, this whole part of your code; if len(a) > 0: print('False') elif len(a) == 0: print('True') else: print('False') Can be reduced to just; print(len(a) == 0)
1st May 2021, 10:50 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Learn about indentation for python. It matters lot in python. you mainly have lot of indentation problem
1st May 2021, 10:47 AM
Ayush Kumar
Ayush Kumar - avatar
+ 1
Thank you sir. You are great
1st May 2021, 10:53 AM
Harsh Mandwariya
Harsh Mandwariya - avatar