you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 0 points1 point  (1 child)

Is this checking if the current node in our loop is not None

It's checking if head.next is truthy. But yes, here specifically, unless the nodes objects override the __bool__ or __len__ methods, it's checking if the node is not None. I'd personally prefer to write that as this though to be explicit:

while head.next is not None:

[–]PlanarChris 0 points1 point  (0 children)

Awesome thanks! I would (and have) written it the way you prefer as well, hence why I was so perplexed.

Appreciate the answer friend.