input: Write a python function to check if a linked list has a loop.
  assert hasLoop() == False # when list is empty
  # Assuming a linked list class and nodes are already defined with 'next' pointers.
  linked_list_with_loop = LinkedList()
  linked_list_with_loop.head = Node(1)
  second = Node(2)
  third = Node(3)
  linked_list_with_loop.head.next = second
  second.next = third
  third.next = linked_list_with_loop.head  # Creating a loop
  assert linked_list_with_loop.hasLoop() == True
  
  linked_list_without_loop = LinkedList()
  linked_list_without_loop.head = Node(1)
  second = Node(2)
  third = Node(3)
  linked_list_without_loop.head.next = second
  second.next = third
  assert linked_list_without_loop.hasLoop() == False
output: class Node:
      def __init__(self, value):
          self.value = value
          self.next = None
  
  class LinkedList:
      def __init__(self):
          self.head = None
      
      def hasLoop(self):
          slow = fast = self.head
          while fast and fast.next:
              slow = slow.next
              fast = fast.next.next
              if slow == fast:
                  return True
          return False