Hello,
if the first linked list is empty, all the nodes from the second linked list should be added to the first one. But the first linked list remains empty.
To solve this problem you should change the following code of block:
if not p: return q if not q: return p
to:
if not p: self.head = q return self.head if not q: return self.head
Best regards
Miguel
Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers