def member_of_nth_fib_lists(listA, listB, needle): n = 1 length = 0 while length <= len(needle): length = len(fl.nth_fib_lists(listA, listB, n)) if fl.nth_fib_lists(listA, listB, n) == needle: return True n += 1 return False
def member_of_nth_fib_lists(listA, listB, needle): lst = fib_random_numbers(len(listA), len(listB)) print(lst) if len(needle) not in lst: return False else: for item in needle: if (item not in listA) and (item not in listB): return False return needle == nth_fib_lists(listA, listB, lst.index(len(needle)) + 1)
def test_fib_list_empty_list(self): self. assertEqual(nth_fib_lists([], [], 35), [])
def test_fib_list_n_greater_than_2(self): self.assertEqual(nth_fib_lists([3, 4], [1, 2, 3], 3), [3, 4, 1, 2, 3])
def test_for_corect_output2(self): self.assertEqual([2], nth_fib_lists([1], [2], 2))
def test_for_corect_output5(self): self.assertEqual([], nth_fib_lists([], [], 100))
def test_fib_list_if_n_equal_to_more_than_2(self): self.assertEqual([4, 5, 1, 2, 4, 5], nth_fib_lists([1, 2], [4, 5], 4))
def test_zero_list_choice(self): self.assertEqual([], nth_fib_lists([1], [2], 0))
def test_second_fibonacci_list(self): self.assertEqual([2], nth_fib_lists([1], [2], 2))
def test_fib_list_for_n_1(self): self.assertEqual(nth_fib_lists([2, 3, 4], [1, 2], 1), [2, 3, 4])
def test_fib_list_empty_list(self): self.assertEqual(nth_fib_lists([], [], 35), [])
def test_fib_list_if_n_equal_to_1(self): self.assertEqual([1, 2, 3], nth_fib_lists([1, 2, 3], [4, 5, 6], 1))
def test_fib_list_if_two_lists_are_empty(self): self.assertEqual([], nth_fib_lists([], [], 4))
def test_fib_list_if_one_list_is_empty(self): self.assertEqual([1, 2, 3], nth_fib_lists([], [1, 2, 3], 2))
def test_fib_list_for_n_2(self): self.assertEqual(nth_fib_lists([2, 3, 5], [1], 2), [1])
def test_for_bigger_fibonacci_lists(self): self.assertEqual([1, 2, 1, 3], nth_fib_lists([1, 2], [1, 3], 3)) self.assertEqual([1, 2, 3, 1, 2, 3], nth_fib_lists([], [1, 2, 3], 4)) self.assertEqual([1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], nth_fib_lists([], [1, 2, 3], 6)) self.assertEqual([], nth_fib_lists([], [], 100))
def test_for_corect_output3(self): self.assertEqual([1, 2, 1, 3], nth_fib_lists([1, 2], [1, 3], 3))
def test_first_fibonacci_list(self): self.assertEqual([1], nth_fib_lists([1], [2], 1))
def test_for_corect_output4(self): self.assertEqual([1, 2, 3, 1, 2, 3], nth_fib_lists([], [1, 2, 3], 4))