0

Can you find some error for me? //Fixed

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

13th Oct 2021, 2:01 PM
Yohann Stantine
Yohann Stantine - avatar
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
13th Oct 2021, 2:17 PM
Slick
Slick - avatar
+ 1
Nah, literally just add the word 'return' as the first word in the single line of the body of that method. Easy fix
13th Oct 2021, 2:30 PM
Slick
Slick - avatar
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.
13th Oct 2021, 2:29 PM
Yohann Stantine
Yohann Stantine - avatar
0
Your code with return. Run it LINE 9 https://code.sololearn.com/cqqPT8qTM36c/?ref=app
13th Oct 2021, 2:31 PM
Slick
Slick - avatar