def test(self):
     """Testing linked list"""
     linked_list = LinkedList()
     linked_list.push_front(1)
     linked_list.push_front(2)
     linked_list.push_front(3)
     self.assertEqual(linked_list.pop_front(), 3)
     self.assertEqual(linked_list.pop_front(), 2)
     self.assertEqual(linked_list.pop_front(), 1)
     self.assertTrue(linked_list.empty())
def fact(number):
    '''"Pretend" to do recursion via a stack and iteration'''

    if number < 0:
        raise ValueError("Less than zero")
    if number in (0, 1):
        return 1

    stack = LinkedList()
    while number > 1:
        stack.push_front(number)
        number -= 1

    result = 1
    while not stack.empty():
        result *= stack.pop_front()

    return result
 def test_find_middle_single_node(self):
     """Testing linked list"""
     linked_list = LinkedList()
     linked_list.push_front(1)
     self.assertEqual(linked_list.find_mid(), 1)