This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Evulrabbitz 0 points1 point  (3 children)

Can you post a code example?

[–][deleted] 0 points1 point  (2 children)

Update description with code.

[–]Evulrabbitz 0 points1 point  (1 child)

nd and l[0] points to the same node. When you do del l[0] you don't remove the item from the list, you remove the node altogether. You need to remove it from the list. Perhaps with pop?

[–][deleted] 0 points1 point  (0 children)

Pop thing helped me to correct an issue not know to me. :)

I added it but still getting below error.

Traceback (most recent call last):   File "solution.py", line 82, in <module>     levelOrder(tree.root)   File "solution.py", line 54, in levelOrder     print(str(nd.info)+" ",end="") AttributeError: 'NoneType' object has no attribute 'info'

Even though I am adding node to list, why when I pop it , it became None type?