def exit_loop(head): #定义两个指针 fast=slow=head while fast.next.next and slow,next: fast=fast.next.next slow=slow.next if fast==slow: return True return False