Linked List Loop Leetcode Problems Python