def member_of_nth_fib_lists(listA, listB, needle): n = 1 fib_lists = nth_fib_lists(listA, listB, n) while len(fib_lists) <= len(needle): if lists_are_equal(fib_lists, needle): return True n += 1 fib_lists = nth_fib_lists(listA, listB, n) return False
def member_of_nth_fib_lists(listA, listB, needle): if listA == needle or listB == needle: return True fib_num = 3 current_fib_list = nth_fib_lists(listA, listB, fib_num) while len(current_fib_list) <= len(needle): if needle == current_fib_list: return True fib_num += 1 current_fib_list = nth_fib_lists(listA, listB, fib_num) return False
def member_of_nth_fib_lists(listA, listB, needle): temp = 0 fib_list = [] while len(fib_list) < len(needle): temp += 1 fib_list = nth_fib_lists(listA, listB, temp) return fib_list == needle
def member_of_nth_fib_lists(listA, listB, needle): fib_list = nth_fib_lists(listA, listB, 5) fib_list = list_to_number(fib_list) fib_list = str(fib_list) needle = list_to_number(needle) needle = str(needle) if needle in fib_list: return True
def member_of_nth_fib_lists(listA, listB, needle): my_list = nth_fib_lists(listA, listB, len(needle) + 5) flag = False for i in range(0, len(my_list)): if my_list[i] == needle[0]: flag = True ix = i for v in needle: if v != my_list[ix]: flag = False break ix += 1 if flag is True: return True return (flag)
def test_five(self): self.assertEqual([], nth_fib_lists([], [], 100))
def test_one(self): self.assertEqual([1], nth_fib_lists([1], [2], 1))
def test_fib_list_with_empty_list(self): self.assertEqual(nth_fib_lists([], [1, 2], 4), [1, 2, 1, 2])
def test_normal_nth_fib(self): self.assertEqual(nth_fib_lists([1, 2], [1, 3], 3), [1, 2, 1, 3])
def test_empty_list(self): self.assertEqual([], nth_fib_lists([], [], 20))
def test_nth_fib_lists_if_n_is_2(self): self.assertEqual([3], nth_fib_lists([2], [3], 2))
def test_nth_fib_with_negative_n(self): self.assertFalse(nth_fib_lists([1, 2], [1, 3], -1))
def test_nth_fib_lists_if_n_is_greater_than_2(self): self.assertEqual([2, 3, 5, 6], nth_fib_lists([2, 3], [5, 6], 3))
def test_first_empty_list(self): self.assertEqual([3], nth_fib_lists([], [3], 3))
def test_nth_fib_lists_if_n_is_2(self): self.assertEqual([3], nth_fib_lists([2], [3], 2))
def test_empty_list(self): self.assertEqual([], nth_fib_lists([], [], 20))
def test_nth_fib_lists_if_n_is_3(self): self.assertEqual([5, 6, 2, 3, 5, 6], nth_fib_lists([2, 3], [5, 6], 4))
def test_nth_fib_lists_if_n_is_greater_than_2(self): self.assertEqual([2, 3, 5, 6], nth_fib_lists([2, 3], [5, 6], 3))
def test_two(self): self.assertEqual([2], nth_fib_lists([1], [2], 2))
def test_nth_fib_lists(self): self.assertEquals(nth_fib_lists([1], [2], 1), [1]) self.assertEquals(nth_fib_lists([1, 2], [1, 3], 3), [1, 2, 1, 3])
def test_nth_fib_lists(self): self.assertEqual([1], nth_fib_lists([1], [2], 1)) self.assertEqual([2], nth_fib_lists([1], [2], 2)) self.assertEqual([1, 2, 1, 3], nth_fib_lists([1, 2], [1, 3], 3)) self.assertEqual([], nth_fib_lists([], [], 100)) self.assertEqual([1, 2, 3, 1, 2, 3], nth_fib_lists([], [1, 2, 3], 4))
def test_n_bigger_than_2(self): self.assertTrue(nth_fib_lists([1], [2], 3))
def test_nth_fib_lists_if_n_is_3(self): self.assertEqual([5, 6, 2, 3, 5, 6], nth_fib_lists([2, 3], [5, 6], 4))
def test_nth_fib_lists(self): self.assertEquals(nth_fib_lists([1], [2], 1), [1]) self.assertEquals(nth_fib_lists([1, 2], [1, 3], 3), [1, 2, 1, 3])
def test_first_empty_list(self): self.assertEqual([3], nth_fib_lists([], [3], 3))
def test_cases(self): self.assertEqual([1], nth_fib_lists([1], [2], 1)) self.assertEqual([2], nth_fib_lists([1], [2], 2)) 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([], nth_fib_lists([], [], 100))
def test_n_eq_1(self): self.assertTrue(nth_fib_lists([1], [2], 1))
def test_1st_fib_list(self): self.assertEqual(nth_fib_lists([1], [2], 1), [1])
def test_nth_fib_with_negative_n(self): self.assertFalse(nth_fib_lists([1, 2], [1, 3], -1))
def test_four(self): self.assertEqual([1, 2, 3, 1, 2, 3], nth_fib_lists([], [1, 2, 3], 4))
def test_three(self): self.assertEqual([1, 2, 1, 3], nth_fib_lists([1, 2], [1, 3], 3))
def test_fib_list_with_2empty_lists(self): self.assertEqual(nth_fib_lists([], [], 20), [])