while (head is not None and head_second_half is not None):
Only head_second should be checked. This simplifies the code and makes it easier to explain and test! I’ve confirmed this works on the LC problem/tests.
Type your question above this line.
Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/6490214644056064