Mar-04-2019, 09:24 PM
Please use python and output tags when posting code and results. Yoriz has done it for you twice. Here are instructions for doing it yourself next time.
The problem is that you are setting HeadVal to None when it matches the node to remove. I think you have your code for removing the head of the list mixed up with the code for removing a non-head node.
I would also note that you should be using __init__ instead of init. The former is done automatically on object creation, and would simplify your code (and remove a source of potential errors). I would also look at __repr__, it is your friend when debugging.
The problem is that you are setting HeadVal to None when it matches the node to remove. I think you have your code for removing the head of the list mixed up with the code for removing a non-head node.
I would also note that you should be using __init__ instead of init. The former is done automatically on object creation, and would simplify your code (and remove a source of potential errors). I would also look at __repr__, it is your friend when debugging.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures