0
Can you find some error for me? //Fixed
4 Respostas
+ 1
Run this code.
You basically check if each symbol is one of the starting brackets ( [, {, or ( ). The logic of the program is wrong because once you get to the ending brackets ( ], }, or ) ), you send a None Type value to the function you made, causing an error.
See how your code runs until the 4th iteration and then calls the error?
EDIT: Yohann Constantine Also when you pop the stack, for whatever reason, you don't get the bracket returned to 'top'. 'top' is then considered None. But the stack was popped, which is why you see the list of 2 parenthesis ['(', '('] when you print the stack in the 4th iteration
https://code.sololearn.com/cAws5Lmiu7Lm/?ref=app
+ 1
Nah, literally just add the word 'return' as the first word in the single line of the body of that method. Easy fix
0
So I need to use another method instead of pop().
You mean when I poped the variable becomes none type?
Thanks I will find another way.
0
Your code with return. Run it LINE 9
https://code.sololearn.com/cqqPT8qTM36c/?ref=app