Node question

current_node == new_node. When they are comparing, are they comparing the value they hold?

Yes. The node is a conceptual thing; the value is actual.

if they’re not nodes they should probably not be named nodes

Yes they are nodes. They are given to me in a form of a question.

Then when current_node = None, what is being altered? Is it the vale it holds? I thought the values are immutable.

to compare two nodes you can’t just compare their values you have to compare their links as well since that is part of a node

if you want to compare their values compare their values, not themselves

the default implementation of __eq__ for objects is identity

assigning a variable doesn’t alter the previous value, it alters the variable and nothing else

your values are probably not immutable. you might mean that the values can’t be replaced, but that would still leave the values themselves mutable, and furthermore you’ve probably not done this in a way that actually prevents modification, nor is that something that is required to be considered a linked list

All there really is to know about linked list is this.

You have cells. Nodes.

A node does two things.
It holds on to a value.
It knows about the next value.
(It might also know about the previous value in the case of a doubly linked list, allowing traversal in both directions)

from that you can figure out all of the rest. operations are just about re-arranging the links in the structure.

you can for example implement this using python’s list. a node holds on to two things, so a node is a list of size 2.

[5, [7, [8, [3, [1, None]]]]]

You can also make your own class for a node. This would do the same thing. Hold on to two things.

class Node: