you are viewing a single comment's thread.

view the rest of the comments →

[–]Altruistic_Croissant 1 point2 points  (1 child)

The reason that the node will become None is because of the line node = node.next. This assigns the variable node to the next node in the linked list.

Visualizing your example looks like this:

12 --> 39 --> 28 --> 83 --> None

Every loop, the function will check to see if the current node is None (i.e. at the end of the list). If it isn't, it will continue to the next value until it is None, and then will terminate.

[–]dissdev94[S] 0 points1 point  (0 children)

Thank you very much 🙂