{"task_id": "0", "problem": "Write a python function to remove first and last occurrence of a given character from the string.", "completion": "\ndef remove_occ(string, char):\n    new_string = string.replace(char, '')\n    if new_string[0] == char:\n        new_string = new_string[1:]\n    if new_string[-1] == char:\n        new_string = new_string[:-1]\n    return new_string\n\n\nassert remove_occ(\"hello\", \"l\") == \"heo\"\nassert remove_occ(\"abcda\", \"a\") == \"bcd\"\nassert remove_occ(\"PHP\", \"P\") == \"H\"\n", "passed": true, "fail_reason": "[]"}
{"task_id": "1", "problem": "Write a function to sort a given matrix in ascending order according to the sum of its rows.", "completion": "\ndef sort_matrix(matrix):\n    # Get the sums of the rows of the matrix\n    row_sums = [sum(row) for row in matrix]\n    # Sort the rows of the matrix based on their sums\n    sorted_rows = sorted(matrix, key=lambda x: x[0])\n    # Return the sorted matrix\n    return sorted_rows\n\n\nassert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]\nassert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]\nassert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "2", "problem": "Write a function to count the most common words in a dictionary.", "completion": "\nfrom collections import Counter\n\ndef count_common(words):\n    counter = Counter(words)\n    most_common = counter.most_common()\n    most_common_words = [x[0] for x in most_common]\n    return most_common_words\n\n\nassert count_common(['red','green','black','pink','black','white','black','eyes','white','black','orange','pink','pink','red','red','white','orange','white',\"black\",'pink','green','green','pink','green','pink','white','orange',\"orange\",'red']) == [('pink', 6), ('black', 5), ('white', 5), ('red', 4)]\nassert count_common(['one', 'two', 'three', 'four', 'five', 'one', 'two', 'one', 'three', 'one']) == [('one', 4), ('two', 2), ('three', 2), ('four', 1)]\nassert count_common(['Facebook', 'Apple', 'Amazon', 'Netflix', 'Google', 'Apple', 'Netflix', 'Amazon']) == [('Apple', 2), ('Amazon', 2), ('Netflix', 2), ('Facebook', 1)]\n", "passed": false, "fail_reason": "[NameError(\"name 'Counter' is not defined\")]"}
{"task_id": "3", "problem": "Write a python function to find the volume of a triangular prism.", "completion": "\nimport math\n\ndef find_Volume(a, b, c, h):\n    \"\"\"\n    Calculates the volume of a triangular prism with the given dimensions.\n\n    Args:\n        a (float): The length of the first side of the triangle.\n        b (float): The length of the second side of the triangle.\n        c (float): The length of the third side of the triangle.\n        h (float): The height of the prism.\n\n    Returns:\n        float: The volume of the triangular prism.\n    \"\"\"\n    # Ensure non-negative prism dimensions\n    assert a >= 0 and b >= 0 and (c >= 0) and (h >= 0), 'Ensure non-negative prism dimensions'\n    # Ensure valid triangle dimensions\n    assert a + b > c and b + c > a and (c + a > b), 'Ensure valid triangle dimensions'\n    # Calculate the volume of the prism\n    v = a * b * c / (4 * math.sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c))) * h\n    return v\n", "passed": true, "fail_reason": "[]"}
{"task_id": "4", "problem": "Write a function to split a string at lowercase letters.", "completion": "\nimport re\n\ndef split_lowerstring(my_string):\n    pattern = re.compile(r\"(?<=[a-z])(?=[A-Z])\", re.IGNORECASE)\n    return pattern.split(my_string)\n\n\nassert split_lowerstring(\"AbCd\")==['bC','d']\nassert split_lowerstring(\"Python\")==['y', 't', 'h', 'o', 'n']\nassert split_lowerstring(\"Programming\")==['r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g']\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "5", "problem": "Write a function to find sequences of lowercase letters joined with an underscore.", "completion": "\ndef text_lowercase_underscore(text):\n    for i in range(len(text)):\n        if text[i].islower() and text[i+1] == '_':\n            return 'Found a match!'\n    return 'Not matched!'\n\n\nassert text_lowercase_underscore(\"aab_cbbbc\")==('Found a match!')\nassert text_lowercase_underscore(\"aab_Abbbc\")==('Not matched!')\nassert text_lowercase_underscore(\"Aaab_abbbc\")==('Not matched!')\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "6", "problem": "Write a function to find the perimeter of a square.", "completion": "\ndef square_perimeter(side_length):\n    return 4 * side_length\n\n\nassert square_perimeter(10)==40\nassert square_perimeter(5)==20\nassert square_perimeter(4)==16\n", "passed": true, "fail_reason": "[]"}
{"task_id": "7", "problem": "Write a function to remove characters from the first string which are present in the second string.", "completion": "\ndef remove_dirty_chars(str1, str2):\n    str1_list = list(str1)\n    str2_list = list(str2)\n    for char in str1_list:\n        if char in str2_list:\n            str1_list.remove(char)\n    output_str = ''.join(str1_list)\n    return output_str\n", "passed": true, "fail_reason": "[]"}
{"task_id": "8", "problem": "Write a function to find whether a given array of integers contains any duplicate element.", "completion": "\ndef test_duplicate(arr):\n    return len(arr) != len(set(arr))\n\n\nassert test_duplicate([1, 2, 3, 4, 5]) == False\n\n\nassert test_duplicate([1, 2, 3, 4, 4]) == True\n\n\nassert test_duplicate([1, 1, 2, 2, 3, 3, 4, 4, 5]) == True\n", "passed": true, "fail_reason": "[]"}
{"task_id": "9", "problem": "Write a function to check if the given number is woodball or not.", "completion": "\ndef is_woodall(num):\n    if num >= 2 and num <= 6 and (num % 3 == 0):\n        return True\n    else:\n        return False\n", "passed": true, "fail_reason": "[]"}
{"task_id": "10", "problem": "Write a function to find m number of multiples of n.", "completion": "\ndef multiples_of_num(num, m):\n    multiples = []\n    for i in range(num, num * m + 1, num):\n        multiples.append(i)\n    return multiples\n\n\nassert multiples_of_num(4, 3) == [3, 6, 9, 12]\n\n\nassert multiples_of_num(2, 5) == [5, 10]\n\n\nassert multiples_of_num(9, 2) == [2, 4, 6, 8, 10, 12, 14, 16, 18]\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "11", "problem": "Write a function to find the first duplicate element in a given array of integers.", "completion": "\ndef find_first_duplicate(arr):\n    seen = set()\n    for num in arr:\n        if num in seen:\n            return num\n        seen.add(num)\n    return -1\n\n\nassert find_first_duplicate([1, 2, 3, 4, 4, 5]) == 4\nassert find_first_duplicate([1, 2, 3, 4]) == -1\nassert find_first_duplicate([1, 1, 2, 3, 3, 2, 2]) == 1\n", "passed": true, "fail_reason": "[]"}
{"task_id": "12", "problem": "Write a python function to find the maximum sum of elements of list in a list of lists.", "completion": "\ndef maximum_sum(list_of_lists):\n    max_sum = None\n    max_list = None\n    for lst in list_of_lists:\n        if max_sum is None or sum(lst) > max_sum:\n            max_sum = sum(lst)\n            max_list = lst\n    return max_sum\n\n\nassert maximum_sum([[1,2,3],[4,5,6],[10,11,12],[7,8,9]]) == 33\nassert maximum_sum([[0,1,1],[1,1,2],[3,2,1]]) == 6\nassert maximum_sum([[0,1,3],[1,2,1],[9,8,2],[0,1,0],[6,4,8]]) == 19\n", "passed": true, "fail_reason": "[]"}
{"task_id": "13", "problem": "Write a function to convert the given binary number to its decimal equivalent.", "completion": "\ndef binary_to_decimal(binary_number):\n    decimal_number = 0\n    for digit in binary_number:\n        decimal_number = decimal_number * 2 + int(digit)\n    return decimal_number\n\n\nassert binary_to_decimal(100) == 4\nassert binary_to_decimal(1011) == 11\nassert binary_to_decimal(1101101) == 109\n", "passed": false, "fail_reason": "[TypeError(\"'int' object is not iterable\")]"}
{"task_id": "14", "problem": "Write a python function to find the product of non-repeated elements in a given array.", "completion": "\ndef find_product(lst):\n    unique_lst = set(lst)\n    product = 1\n    for num in unique_lst:\n        if lst.count(num) == 1:\n            product *= num\n    return product\n\n\nassert find_product([1,1,2,3],4) == 6\nassert find_product([1,2,3,1,1],5) == 6\nassert find_product([1,1,4,5,6],5) == 120\n", "passed": false, "fail_reason": "[TypeError('find_product() takes 1 positional argument but 2 were given')]"}
{"task_id": "15", "problem": "Write a function to check if the given tuple list has all k elements.", "completion": "\ndef check_k_elements(tuples, k):\n    for t in tuples:\n        if k not in t:\n            return False\n    return True\n\n\nassert check_k_elements([(4, 4), (4, 4, 4), (4, 4), (4, 4, 4, 4), (4, )], 4) == True\nassert check_k_elements([(7, 7, 7), (7, 7)], 7) == True\nassert check_k_elements([(9, 9), (9, 9, 9, 9)], 7) == False\n", "passed": true, "fail_reason": "[]"}
{"task_id": "16", "problem": "Write a python function to remove all digits from a list of strings.", "completion": "\ndef remove_digits(my_list):\n    return [output_string for input_string in my_list for char in input_string if not char.isdigit()]\n\n\nmy_list = ['4words', '3letters', '4digits']\nresult = remove_digits(my_list)\nprint(result)  # Output: ['words', 'letters', 'digits']\n", "passed": false, "fail_reason": "[NameError(\"name 'output_string' is not defined\")]"}
{"task_id": "17", "problem": "Write a python function to find binomial co-efficient.", "completion": "\ndef binomial_coeff(n, k):\n    if type(n) in (float, complex):\n        return 'Binomial coefficients are not defined for floating point and complex numbers.'\n    if k < 0 or k > n:\n        return 0\n    if k == 0 or k == n:\n        return 1\n    return binomial_coeff(n-1, k-1) + binomial_coeff(n-1, k)\n", "passed": true, "fail_reason": "[]"}
{"task_id": "18", "problem": "Write a python function to find the element occurring odd number of times.", "completion": "\ndef get_odd_occurrence(arr):\n    freq = {}\n    for num in arr:\n        freq[num] = freq.get(num, 0) + 1\n    for num in arr:\n        if freq[num] % 2 != 0:\n            return num\n    return None\n\n\nassert get_odd_occurrence([1,2,3,1,2,3,1]) == 1\nassert get_odd_occurrence([1,2,3,2,3,1,3]) == 3\nassert get_odd_occurrence([2,3,5,4,5,2,4,3,5,2,4,4,2]) == 5\n", "passed": true, "fail_reason": "[]"}
{"task_id": "19", "problem": "Write a python function to count all the substrings starting and ending with same characters.", "completion": "\ndef count_substrings_with_equal_ends(input_str):\n    count = 0\n    for i in range(len(input_str)):\n        for j in range(i + 1, len(input_str) + 1):\n            substr = input_str[i:j]\n            if substr[0] == substr[-1]:\n                count += 1\n    return count\n\n\nassert count_substrings_with_equal_ends(\"abc\") == 3\nassert count_substrings_with_equal_ends(\"abcda\") == 6\nassert count_substrings_with_equal_ends(\"ab\") == 2\n", "passed": true, "fail_reason": "[]"}
{"task_id": "20", "problem": "Write a function to find the top k integers that occur most frequently from given lists of sorted and distinct integers using heap queue algorithm.", "completion": "\nimport heapq\n\ndef find_top_k_integers(lists, k):\n    frequency = {}\n    for list in lists:\n        for value in list:\n            if value in frequency:\n                frequency[value] += 1\n            else:\n                frequency[value] = 1\n    heap = []\n    for value, freq in frequency.items():\n        heapq.heappush(heap, (freq, value))\n        if len(heap) > k:\n            heapq.heappop(heap)\n    k_most_common = []\n    while heap:\n        freq, value = heapq.heappop(heap)\n        k_most_common.append((value, freq))\n    k_most_common.reverse()\n    return k_most_common\n", "passed": true, "fail_reason": "[]"}
{"task_id": "21", "problem": "Write a python function to find the largest prime factor of a given number.", "completion": "\ndef max_prime_factor(n):\n    if n <= 1:\n        return n\n    i = 2\n    while i * i <= n:\n        if n % i == 0:\n            n = n // i\n        else:\n            i += 1\n    return n\n\n\nassert max_prime_factor(15) == 5\nassert max_prime_factor(6) == 3\nassert max_prime_factor(2) == 2\n", "passed": true, "fail_reason": "[]"}
{"task_id": "22", "problem": "Write a python function to convert a decimal number to binary number.", "completion": "\ndef decimal_to_binary(decimal_number):\n    return bin(decimal_number).replace('0b', '')\n\n\nassert decimal_to_binary(10) == 1010\nassert decimal_to_binary(1) == 1\nassert decimal_to_binary(20) == 10100\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "23", "problem": "Write a python function to find the missing number in a sorted array.", "completion": "\ndef find_missing(arr):\n    sorted_arr = sorted(arr)\n    curr = sorted_arr[0]\n    for element in sorted_arr[1:]:\n        if element != curr + 1:\n            return curr + 1\n        else:\n            curr = element\n    return missing\n\n\nassert find_missing([1,2,3,5],4) == 4\nassert find_missing([1,3,4,5],4) == 2\nassert find_missing([1,2,3,5,6,7],5) == 4\n\n\n[1,2,3,5]\n[1,3,4,5]\n[1,2,3,5,6,7]\n", "passed": false, "fail_reason": "[TypeError('find_missing() takes 1 positional argument but 2 were given')]"}
{"task_id": "24", "problem": "Write a function to find the n-th rectangular number.", "completion": "\ndef find_rect_num(n):\n    count = 0\n    for i in range(1, n+1):\n        count += i * i\n    return count\n\n\nassert find_rect_num(4) == 20\nassert find_rect_num(5) == 30\nassert find_rect_num(6) == 42\n\n\ndef find_rect_num(n):\n    return sum([i * i for i in range(1, n+1)])\n\n\nassert find_rect_num(4) == 20\nassert find_rect_num(5) == 30\nassert find_rect_num(6) == 42\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "25", "problem": "Write a python function to find the nth digit in the proper fraction of two given numbers.", "completion": "\nfrom decimal import Decimal\n\ndef find_Nth_Digit(a, b, n):\n    if n > 0:\n        return Decimal(fibonacci(n)) / Decimal(fibonacci(n - 1))\n    else:\n        return 0\n\n\ndef fibonacci(n):\n    if n == 0:\n        return 0\n    else:\n        return fibonacci(n - 1) + fibonacci(n - 2)\n\n\nassert find_Nth_Digit(1,2,1) == 5\nassert find_Nth_Digit(3,5,1) == 6\nassert find_Nth_Digit(5,6,5) == 3\n", "passed": false, "fail_reason": "[NameError(\"name 'Decimal' is not defined\")]"}
{"task_id": "26", "problem": "Write a function to sort a given mixed list of integers and strings.", "completion": "\ndef sort_mixed_list(mixed_list):\n    strings = [element for element in mixed_list if isinstance(element, str)]\n    strings.sort()\n    sorted_list = []\n    i = 0\n    for element in mixed_list:\n        if isinstance(element, str):\n            sorted_list.append(strings[i])\n            i += 1\n        else:\n            sorted_list.append(element)\n    return sorted_list\n\n\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "27", "problem": "Write a function to find the division of first even and odd number of a given list.", "completion": "\ndef div_even_odd(lst):\n    odd_numbers, even_numbers = helper_function(lst)\n    if len(even_numbers) == 0:\n        return None\n    else:\n        return even_numbers[0] / odd_numbers[0]\n\n\ndef helper_function(lst):\n    odd_numbers = []\n    even_numbers = []\n    for num in lst:\n        if num % 2 == 0:\n            even_numbers.append(num)\n        else:\n            odd_numbers.append(num)\n    return (odd_numbers, even_numbers)\n\n\nassert div_even_odd([1,3,5,7,4,1,6,8])==4\nassert div_even_odd([1,2,3,4,5,6,7,8,9,10])==2\nassert div_even_odd([1,5,7,9,10])==10\n", "passed": false, "fail_reason": "[NameError(\"name 'helper_function' is not defined\")]"}
{"task_id": "28", "problem": "Write a function to check if the letters of a given string can be rearranged so that two characters that are adjacent to each other are different.", "completion": "\ndef rearrange_string(string):\n    # Check if the string is a palindrome\n    is_palindromeable = False\n    for i in range(len(string)):\n        j = len(string) - i - 1\n        if string[i] == string[j]:\n            is_palindromeable = True\n        else:\n            is_palindromeable = False\n            break\n\n    # If the string is a palindrome, return the original string\n    if is_palindromeable:\n        return string\n\n    # Otherwise, rearrange the string\n    new_string = \"\"\n    for i in range(len(string)):\n        if string[i] != string[i-1]:\n            new_string += string[i]\n\n    return new_string\n\n\nassert rearrange_string(\"aab\")==('aba')\nassert rearrange_string(\"aabb\")==('abab')\nassert rearrange_string(\"abccdd\")==('cdabcd')\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "29", "problem": "Write a function to find frequency of the elements in a given list of lists using collections module.", "completion": "\nfrom collections import Counter\n\ndef freq_element(list_of_lists):\n    counter = Counter()\n    for sublist in list_of_lists:\n        counter.update(sublist)\n    return counter\n\n\nassert freq_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]]) == ({2: 3, 1: 2, 5: 2, 3: 1, 4: 1, 6: 1, 7: 1, 9: 1})\nassert freq_element([[1,2,3,4],[5,6,7,8],[9,10,11,12]]) == ({1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1})\nassert freq_element([[15,20,30,40],[80,90,100,110],[30,30,80,90]]) == ({30: 3, 80: 2, 90: 2, 15: 1, 20: 1, 40: 1, 100: 1, 110: 1})\n", "passed": false, "fail_reason": "[NameError(\"name 'Counter' is not defined\")]"}
{"task_id": "30", "problem": "Write a function to filter even numbers using lambda function.", "completion": "\ndef filter_evennumbers(numbers):\n    return list(filter(lambda num: num % 2 == 0, numbers))\n\n\nassert filter_evennumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[2, 4, 6, 8, 10]\nassert filter_evennumbers([10,20,45,67,84,93])==[10,20,84]\nassert filter_evennumbers([5,7,9,8,6,4,3])==[8,6,4]\n", "passed": true, "fail_reason": "[]"}
{"task_id": "31", "problem": "Write a python function to find the sum of repeated elements in a given array.", "completion": "\ndef find_sum(arr, target):\n    unique_elements = set()\n    total_sum = 0\n    for element in arr:\n        if element not in unique_elements:\n            unique_elements.add(element)\n            total_sum += element\n    return total_sum\n\n\nassert find_sum([1,2,3,1,1,4,5,6],8) == 3\nassert find_sum([1,2,3,1,1],5) == 3\nassert find_sum([1,1,2],3) == 2\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "32", "problem": "Write a function to find sequences of lowercase letters joined with an underscore using regex.", "completion": "\nimport re\n\ndef text_match(text):\n    pattern = re.compile('[a-z]+_[a-z]+')\n    if pattern.search(text):\n        return 'Found a match!'\n    else:\n        return 'Not matched!'\n\n\nassert text_match(\"aab_cbbbc\") == 'Found a match!'\nassert text_match(\"aab_Abbbc\") == 'Not matched!'\nassert text_match(\"Aaab_abbbc\") == 'Not matched!'\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "33", "problem": "Write a function that matches a word at the beginning of a string.", "completion": "\ndef text_match_string(sentence, letter):\n    words = sentence.split()\n    for word in words:\n        if word[0] == letter:\n            return 'Found a match!'\n    return 'Not matched!'\n\n\nassert text_match_string(\" python\", \"p\") == \"Found a match!\"\nassert text_match_string(\"python\", \"p\") == \"Found a match!\"\nassert text_match_string(\"  lang\", \"l\") == \"Found a match!\"\nassert text_match_string(\"python\", \"a\") == \"Not matched!\"\nassert text_match_string(\"python\", \"b\") == \"Not matched!\"\n", "passed": true, "fail_reason": "[]"}
{"task_id": "34", "problem": "Write a function to find the gcd of the given array elements.", "completion": "\nimport math\n\ndef get_gcd(arr):\n    if len(arr) == 0:\n        return None\n    gcd = arr[0]\n    for i in range(1, len(arr)):\n        gcd = math.gcd(gcd, arr[i])\n    return gcd\n\n\nassert get_gcd([2, 4, 6, 8, 16]) == 2\nassert get_gcd([1, 2, 3]) == 1\nassert get_gcd([2, 4, 6, 8]) == 2\n", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "35", "problem": "Write a python function to determine whether all the numbers are different from each other are not.", "completion": "\ndef test_distinct(my_list):\n    for i in range(len(my_list)):\n        for j in range(i + 1, len(my_list)):\n            if my_list[i] == my_list[j]:\n                return False\n    return True\n\n\nassert test_distinct([1,5,7,9]) == True\nassert test_distinct([2,4,5,5,7,9]) == False\nassert test_distinct([1,2,3]) == True\n", "passed": true, "fail_reason": "[]"}
{"task_id": "36", "problem": "Write a python function to find the last digit when factorial of a divides factorial of b.", "completion": "\ndef compute_Last_Digit(a, b):\n    last_digit_a = abs(a) % 10\n    last_digit_b = abs(b) % 10\n    return last_digit_a * last_digit_b\n", "passed": true, "fail_reason": "[]"}
{"task_id": "37", "problem": "Write a python function to set all odd bits of a given number.", "completion": "\ndef odd_bit_set_number(n):\n    # Set all odd bits of the given number\n    result = 0\n    for i in range(n.bit_length()):\n        if n & (1 << i):\n            result |= 1 << i\n    return result\n\n\nassert odd_bit_set_number(10) == 15\nassert odd_bit_set_number(20) == 21\nassert odd_bit_set_number(30) == 31\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "38", "problem": "Write a function to extract every first or specified element from a given two-dimensional list.", "completion": "\ndef specified_element(my_list, index):\n    return [element[index] for element in my_list]\n\n\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]], 0) == [1, 4, 7]\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]], 2) == [3, 6, 9]\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]], 1) == [2, 5, 1]\n", "passed": true, "fail_reason": "[]"}
{"task_id": "39", "problem": "Write a function to find the list with minimum length using lambda function.", "completion": "\ndef min_length_list(lists):\n    return min(lists, key=lambda x: len(x))\n\n\nassert min_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(1, [0])\nassert min_length_list([[1,2,3,4,5],[1,2,3,4],[1,2,3],[1,2],[1]])==(1,[1])\nassert min_length_list([[3,4,5],[6,7,8,9],[10,11,12],[1,2]])==(2,[1,2])\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "40", "problem": "Write a function to print check if the triangle is equilateral or not.", "completion": "\ndef check_equilateral(side1, side2, side3):\n    if side1 == side2 == side3:\n        print('Equilateral triangle')\n        return True\n    else:\n        print('Not an equilateral triangle')\n        return False\n\n\nassert check_equilateral(6,8,12)==False\nassert check_equilateral(6,6,12)==False\nassert check_equilateral(6,6,6)==True\n", "passed": true, "fail_reason": "[]"}
{"task_id": "41", "problem": "Write a function to caluclate area of a parallelogram.", "completion": "\nimport math\n\ndef parallelogram_area(base, height):\n    return base * height\n\n\nassert parallelogram_area(10, 20) == 200\nassert parallelogram_area(15, 20) == 300\nassert parallelogram_area(8, 9) == 72\n", "passed": true, "fail_reason": "[]"}
{"task_id": "42", "problem": "Write a python function to check whether the first and last characters of a given string are equal or not.", "completion": "\ndef check_Equality(string):\n    if len(string) < 2:\n        return \"Not Equal\"\n    if string[0] == string[-1]:\n        return \"Equal\"\n    else:\n        return \"Not Equal\"\n\n\nassert check_Equality(\"abcda\") == \"Equal\"\nassert check_Equality(\"ab\") == \"Not Equal\"\nassert check_Equality(\"mad\") == \"Not Equal\"\n", "passed": true, "fail_reason": "[]"}
{"task_id": "43", "problem": "Write a function to sort the given array by using counting sort.", "completion": "\ndef counting_sort(arr):\n    # Find the maximum element in the array\n    max_val = max(arr)\n\n    # Create a count array to store the number of elements in each bucket\n    count = [0] * (max_val + 1)\n\n    # Fill the count array with the number of elements in each bucket\n    for i in range(len(arr)):\n        count[arr[i]] += 1\n\n    # Create a temporary array to store the sorted elements\n    temp = [0] * len(arr)\n\n    # Fill the temporary array with the sorted elements\n    for i in range(len(arr)):\n        for j in range(count[i]):\n            temp[i] = arr[i]\n\n    # Return the sorted array\n    return temp\n\n\nassert counting_sort([1,23,4,5,6,7,8]) == [1, 4, 5, 6, 7, 8, 23]\nassert counting_sort([12, 9, 28, 33, 69, 45]) == [9, 12, 28, 33, 45, 69]\nassert counting_sort([8, 4, 14, 3, 2, 1]) == [1, 2, 3, 4, 8, 14]\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "44", "problem": "Write a function to find t-nth term of geometric series.", "completion": "\ndef tn_gp(a, r, n):\n    return a * r ** (n-1)\n\n\nassert tn_gp(1,5,2)==16\nassert tn_gp(1,5,4)==256\nassert tn_gp(2,6,3)==486\n\n\nprint(tn_gp(1,5,4)) # prints 256\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "45", "problem": "Write a python function to check if a given number is one less than twice its reverse.", "completion": "\ndef check(num):\n    reverse = int(str(num)[::-1])\n    if num == reverse - 1:\n        return True\n    else:\n        return False\n\n\nassert check(70) == False\nassert check(23) == False\nassert check(73) == True\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "46", "problem": "Write a python function to find the largest number that can be formed with the given digits.", "completion": "\ndef find_max_num(digits, n):\n    largest = 0\n    for i in range(n):\n        largest = largest * 10 + digits[i]\n    return largest\n\n\nassert find_max_num([1, 2, 3], 3) == 321\n\n\nassert find_max_num([4, 5, 6, 1], 4) == 6541\n\n\nassert find_max_num([1, 2, 3, 9], 4) == 9321\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "47", "problem": "Write a python function to check whether the given two integers have opposite sign or not.", "completion": "\ndef opposite_Signs(x, y):\n    return x * y < 0\n\n\nassert opposite_Signs(1, -2) == True\n\n\nassert opposite_Signs(3, 2) == False\n\n\nassert opposite_Signs(-10, -10) == False\n", "passed": true, "fail_reason": "[]"}
{"task_id": "48", "problem": "Write a function to find the nth octagonal number.", "completion": "\ndef is_octagonal(n):\n    if n == 1:\n        return 1\n    else:\n        return is_octagonal(n - 1) + 7 * n - 4\n\n\nassert is_octagonal(5) == 65\nassert is_octagonal(10) == 280\nassert is_octagonal(15) == 645\n", "passed": false, "fail_reason": "[NameError(\"name 'is_octagonal' is not defined\")]"}
{"task_id": "49", "problem": "Write a function to find the maximum length of the subsequence with difference between adjacent elements for the given array.", "completion": "\ndef max_len_sub(arr, difference):\n    dp = {}\n    maxLength = 0\n    for num in arr:\n        dp[num] = dp.get(num - difference, 0) + 1\n        maxLength = max(maxLength, dp[num])\n    return maxLength\n\n\nassert max_len_sub([2, 5, 6, 3, 7, 6, 5, 8], 8) == 5\nassert max_len_sub([-2, -1, 5, -1, 4, 0, 3], 7) == 4\nassert max_len_sub([9, 11, 13, 15, 18], 5) == 1\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "50", "problem": "Write a python function to count number of substrings with the sum of digits equal to their length.", "completion": "\ndef count_substrings(s, target_sum):\n    count = 0\n    for i in range(len(s)):\n        for j in range(i, len(s)):\n            if sum(int(c) for c in s[i:j+1]) == target_sum:\n                count += 1\n    return count\n\n\nassert count_substrings('112112', 6) == 6\nassert count_substrings('111', 3) == 6\nassert count_substrings('1101112', 7) == 12\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "51", "problem": "Write a python function to find smallest number in a list.", "completion": "\ndef smallest_num(num_list):\n    smallest = num_list[0]\n    for num in num_list:\n        if num < smallest:\n            smallest = num\n    return smallest\n\n\nassert smallest_num([10, 20, 1, 45, 99]) == 1\nassert smallest_num([1, 2, 3]) == 1\nassert smallest_num([45, 46, 50, 60]) == 45\n", "passed": true, "fail_reason": "[]"}
{"task_id": "52", "problem": "Write a function to find the maximum difference between available pairs in the given tuple list.", "completion": "\ndef max_difference(element_list):\n    max_diff = 0\n    for i in range(len(element_list)):\n        for j in range(i + 1, len(element_list)):\n            diff = element_list[j] - element_list[i]\n            if diff > max_diff:\n                max_diff = diff\n    return max_diff\n\n\nassert max_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7\nassert max_difference([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15\nassert max_difference([(12, 35), (21, 27), (13, 23), (41, 22)]) == 23\n", "passed": false, "fail_reason": "[TypeError(\"unsupported operand type(s) for -: 'tuple' and 'tuple'\")]"}
{"task_id": "53", "problem": "Write a function to sort a list of tuples using lambda.", "completion": "\ndef subject_marks(tuples):\n    return sorted(tuples, key=lambda x: x[1])\n\n\nassert subject_marks([('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)])==[('Social sciences', 82), ('English', 88), ('Science', 90), ('Maths', 97)]\nassert subject_marks([('Telugu',49),('Hindhi',54),('Social',33)])==([('Social',33),('Telugu',49),('Hindhi',54)])\nassert subject_marks([('Physics',96),('Chemistry',97),('Biology',45)])==([('Biology',45),('Physics',96),('Chemistry',97)])\n", "passed": true, "fail_reason": "[]"}
{"task_id": "54", "problem": "Write a function of recursion list sum.", "completion": "\ndef recursive_list_sum(my_list):\n    total = 0\n    for element in my_list:\n        if isinstance(element, list):\n            total += recursive_list_sum(element)\n        else:\n            total += element\n    return total\n\n\nassert recursive_list_sum(([1, 2, [3,4],[5,6]]))==21\nassert recursive_list_sum(([7, 10, [15,14],[19,41]]))==106\nassert recursive_list_sum(([10, 20, [30,40],[50,60]]))==210\n", "passed": false, "fail_reason": "[NameError(\"name 'recursive_list_sum' is not defined\")]"}
{"task_id": "55", "problem": "Write a python function to count positive numbers in a list.", "completion": "\ndef pos_count(numbers):\n    return sum(1 for num in numbers if num > 0)\n\n\nassert pos_count([1,-2,3,-4]) == 2\n\n\nassert pos_count([3,4,5,-1]) == 3\n\n\nassert pos_count([1,2,3,4]) == 4\n\n\ndef pos_count(numbers):\n    positive_numbers = 0\n    for num in numbers:\n        if num > 0:\n            positive_numbers += 1\n    return positive_numbers\n\n\nassert pos_count([1,-2,3,-4]) == 2\n", "passed": true, "fail_reason": "[]"}
{"task_id": "56", "problem": "Write a function to find the number of ways to partition a set of bell numbers.", "completion": "\ndef bell_number(n):\n    if n == 0:\n        return 1\n    else:\n        return bell_number(n-1) + bell_number(n-2)\n\n\nassert bell_number(2)==2\n\n\nassert bell_number(10)==115975\n\n\nassert bell_number(56)==6775685320645824322581483068371419745979053216268760300\n", "passed": false, "fail_reason": "[NameError(\"name 'bell_number' is not defined\")]"}
{"task_id": "57", "problem": "Write a python function to check whether the given array is monotonic or not.", "completion": "\ndef is_monotonic(my_list):\n    \"\"\"\n    Returns True if the list is monotonic, False otherwise.\n    \"\"\"\n    is_monotonic = True\n    for i in range(len(my_list) - 1):\n        if my_list[i] > my_list[i + 1]:\n            is_monotonic = False\n            break\n    return is_monotonic\n\n\nassert is_monotonic([6, 5, 4, 4]) == True\nassert is_monotonic([1, 2, 2, 3]) == True\nassert is_monotonic([1, 3, 2]) == False\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "58", "problem": "Write a function to check whether a list contains the given sublist or not.", "completion": "\ndef is_sublist(main_list, sublist):\n    if isinstance(sublist, list):\n        if sublist == []:\n            return True\n        elif sublist == main_list:\n            return True\n        elif len(sublist) > len(main_list):\n            return False\n        else:\n            for i in range(len(main_list)):\n                if main_list[i] == sublist[0]:\n                    return is_sublist(main_list[i + 1:], sublist[1:])\n            return False\n    else:\n        return sublist in main_list\n\n\nassert is_sublist([2,4,3,5,7],[3,7])==False\nassert is_sublist([2,4,3,5,7],[4,3])==True\nassert is_sublist([2,4,3,5,7],[1,6])==False\n", "passed": false, "fail_reason": "[NameError(\"name 'is_sublist' is not defined\")]"}
{"task_id": "59", "problem": "Write a function to find whether all the given tuples have equal length or not.", "completion": "\ndef get_equal(lst, length):\n    return all(len(x) == length for x in lst)\n\n\nassert get_equal([(11, 22, 33), (44, 55, 66)], 3) == 'All tuples have same length'\n\n\nassert get_equal([(1, 2, 3), (4, 5, 6, 7)], 3) == 'All tuples do not have same length'\n\n\nassert get_equal([(1, 2), (3, 4)], 2) == 'All tuples have same length'\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "60", "problem": "Write a function to sort a list of elements using comb sort.", "completion": "\ndef comb_sort(arr):\n    gap = len(arr)\n    swapped = True\n    while gap > 1 or swapped:\n        if gap > 1:\n            gap = int(gap / 1.247330950103979)\n        swapped = False\n        for i in range(len(arr) - gap):\n            if arr[i] > arr[i + gap]:\n                arr[i], arr[i + gap] = arr[i + gap], arr[i]\n                swapped = True\n    return arr\n\n\nassert comb_sort([5, 15, 37, 25, 79]) == [5, 15, 25, 37, 79]\nassert comb_sort([41, 32, 15, 19, 22]) == [15, 19, 22, 32, 41]\nassert comb_sort([99, 15, 13, 47]) == [13, 15, 47, 99]\n", "passed": true, "fail_reason": "[]"}
{"task_id": "61", "problem": "Write a python function to check whether the given number can be represented as difference of two squares or not.", "completion": "\ndef dif_Square(n):\n    root = int(sqrt(n))\n    return n == root * root\n\n\nassert dif_Square(5) == True\nassert dif_Square(10) == False\nassert dif_Square(15) == True\n", "passed": false, "fail_reason": "[NameError(\"name 'sqrt' is not defined\")]"}
{"task_id": "62", "problem": "Write a function to split the given string with multiple delimiters by using regex.", "completion": "\nimport re\n\ndef multiple_split(my_string, delimiters):\n    pattern = re.compile(delimiters, re.IGNORECASE)\n    return pattern.split(my_string)\n\n\nassert multiple_split('Forces of the \\ndarkness*are coming into the play.', '*') == ['Forces of the ', 'darkness', 'are coming into the play.']\nassert multiple_split('Mi Box runs on the \\n Latest android*which has google assistance and chromecast.', '*') == ['Mi Box runs on the ', ' Latest android', 'which has google assistance and chromecast.']\nassert multiple_split('Certain services\\nare subjected to change*over the seperate subscriptions.', '*') == ['Certain services', 'are subjected to change', 'over the seperate subscriptions.']\n", "passed": false, "fail_reason": "[error('nothing to repeat at position 0')]"}
{"task_id": "63", "problem": "Write a function to check whether it follows the sequence given in the patterns array.", "completion": "\nimport re\n\ndef is_samepatterns(strings, patterns):\n    result = []\n    for string, pattern in zip(strings, patterns):\n        if re.search(pattern, string):\n            result.append(True)\n        else:\n            result.append(False)\n    return all(result)\n\n\nassert is_samepatterns([\"red\",\"green\",\"green\"], [\"a\", \"b\", \"b\"])==True\nassert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\",\"b\"])==False\nassert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\"])==False\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "64", "problem": "Write a function to find tuples which have all elements divisible by k from the given list of tuples.", "completion": "\ndef find_tuples(tuples, k):\n    if not isinstance(k, int):\n        return \"Error: Argument 'k' should be an integer\"\n    if not all((isinstance(t, tuple) for t in tuples)):\n        return 'Error: All elements should be tuples'\n    indices = [i for i, t in enumerate(tuples) if k in t]\n    if not indices:\n        return f'No tuples found containing the number {k}'\n    return [tuples[i] for i in indices]\n\n\nassert find_tuples([(6, 24, 12), (7, 9, 6), (12, 18, 21)], 6) == '[(6, 24, 12)]'\nassert find_tuples([(5, 25, 30), (4, 2, 3), (7, 8, 9)], 5) == '[(5, 25, 30)]'\nassert find_tuples([(7, 9, 16), (8, 16, 4), (19, 17, 18)], 4) == '[(8, 16, 4)]'\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "65", "problem": "Write a python function to count the number of squares in a rectangle.", "completion": "\ndef count_squares(width, height):\n    return (width * height)\n\n\nassert count_squares(4, 3) == 20\nassert count_squares(2, 2) == 5\nassert count_squares(1, 1) == 1\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "66", "problem": "Write a python function to find the difference between sum of even and odd digits.", "completion": "\ndef is_diff(n):\n    digits = [int(s) for s in str(n) if s.isdigit()]\n    even_nums_sum = sum((d for d in digits if d % 2 == 0))\n    odd_nums_sum = sum((d for d in digits if d % 2 == 1))\n    return even_nums_sum != odd_nums_sum\n\n\nassert is_diff(12345) == False\nassert is_diff(1212112) == True\nassert is_diff(1212) == False\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "67", "problem": "Write a python function to find number of integers with odd number of set bits.", "completion": "\ndef count_With_Odd_SetBits(n):\n    count = 0\n    while n > 0:\n        if n & 1:\n            count += 1\n        n >>= 1\n    return count\n\n\nassert count_With_Odd_SetBits(5) == 3\nassert count_With_Odd_SetBits(10) == 5\nassert count_With_Odd_SetBits(15) == 8\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "68", "problem": "Write a python function to check whether the length of the word is odd or not.", "completion": "\ndef word_len(word):\n    return len(word) % 2 == 1\n\n\nassert word_len(\"Hadoop\") == False\n\n\nassert word_len(\"great\") == True\n\n\nassert word_len(\"structure\") == True\n", "passed": true, "fail_reason": "[]"}
{"task_id": "69", "problem": "Write a function to find the nth tetrahedral number.", "completion": "\ndef tetrahedral_number(n):\n    if n < 0:\n        return 'Input must be a non-negative integer.'\n    tetra_list = [1, 4, 2, 6]\n    for i in range(4, n + 1):\n        if i % 2 == 0:\n            tetra_list.append(1 + i // 2)\n        elif i % 3 == 0:\n            tetra_list.append(tetra_list[i - 1] + tetra_list[i - 2])\n        else:\n            tetra_list.append(tetra_list[i - 1] + tetra_list[i - 2] + tetra_list[i - 3])\n    return tetra_list[:n + 1]\n\n\nassert tetrahedral_number(5) == 35.0\nassert tetrahedral_number(6) == 56.0\nassert tetrahedral_number(7) == 84.0\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "70", "problem": "Write a function to zip the two given tuples.", "completion": "\ndef zip_tuples(tuple1, tuple2):\n    return tuple(zip(tuple1, tuple2))\n\n\nassert zip_tuples((7, 8, 4, 5, 9, 10),(1, 5, 6) ) == [(7, 1), (8, 5), (4, 6), (5, 1), (9, 5), (10, 6)]\nassert zip_tuples((8, 9, 5, 6, 10, 11),(2, 6, 7) ) == [(8, 2), (9, 6), (5, 7), (6, 2), (10, 6), (11, 7)]\nassert zip_tuples((9, 10, 6, 7, 11, 12),(3, 7, 8) ) == [(9, 3), (10, 7), (6, 8), (7, 3), (11, 7), (12, 8)]\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "71", "problem": "Write a function to find the volume of a sphere.", "completion": "\ndef volume_sphere(radius):\n    pi = 3.14159\n    volume = (4 / 3) * pi * radius ** 3\n    return volume\n\n\nassert volume_sphere(10) == 4188.790204786391\nassert volume_sphere(25) == 65449.84694978735\nassert volume_sphere(20) == 33510.32163829113\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "72", "problem": "Write a python function to find the character made by adding all the characters of the given string.", "completion": "\ndef get_char(s):\n    if not s.isalpha():\n        return 'Please input a string ending with a alphabet.'\n    else:\n        return chr(ord(s[-1]) + 1)\n\n\nassert get_char(\"abc\") == \"f\"\nassert get_char(\"gfg\") == \"t\"\nassert get_char(\"ab\") == \"c\"\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "73", "problem": "Write a function to find the n-th number in newman conway sequence.", "completion": "\ndef sequence(n):\n    if n == 1:\n        return 0\n    elif n == 2:\n        return 2\n    else:\n        return 2 * sequence(n - 1)\n\n\nassert sequence(10) == 6\nassert sequence(2) == 1\nassert sequence(3) == 2\n", "passed": false, "fail_reason": "[NameError(\"name 'sequence' is not defined\")]"}
{"task_id": "74", "problem": "Write a function to find the surface area of a sphere.", "completion": "\nimport math\n\ndef surfacearea_sphere(radius):\n    return 4 * math.pi * radius * radius\n", "passed": true, "fail_reason": "[]"}
{"task_id": "75", "problem": "Write a function to find nth centered hexagonal number.", "completion": "\ndef centered_hexagonal_number(n):\n    hexagonal = n * (2 * n - 1)\n    while True:\n        if isPentagonal(hexagonal):\n            return hexagonal\n        n += 1\n        hexagonal = n * (2 * n - 1)\n\n\nassert centered_hexagonal_number(10) == 271\n\n\nassert centered_hexagonal_number(20) == 1071\n\n\nassert centered_hexagonal_number(5) == 21\n\n\nassert centered_hexagonal_number(-5) == -21\n\n\nassert centered_hexagonal_number(3.5) == 21\n", "passed": false, "fail_reason": "[NameError(\"name 'isPentagonal' is not defined\")]"}
{"task_id": "76", "problem": "Write a function to merge three dictionaries into a single expression.", "completion": "\ndef merge_dictionaries_three(dict1, dict2, dict3):\n    return {**dict1, **dict2, **dict3}\n\n\nassert merge_dictionaries_three({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" }, { \"G\": \"Green\", \"W\": \"White\" },{ \"O\": \"Orange\", \"W\": \"White\", \"B\": \"Black\" })=={'B': 'Black', 'R': 'Red', 'P': 'Pink', 'G': 'Green', 'W': 'White', 'O': 'Orange'}\nassert merge_dictionaries_three({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" }, { \"G\": \"Green\", \"W\": \"White\" },{\"L\":\"lavender\",\"B\":\"Blue\"})=={'W': 'White', 'P': 'Pink', 'B': 'Black', 'R': 'Red', 'G': 'Green', 'L': 'lavender'}\nassert merge_dictionaries_three({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" },{\"L\":\"lavender\",\"B\":\"Blue\"},{ \"G\": \"Green\", \"W\": \"White\" })=={'B': 'Black', 'P': 'Pink', 'R': 'Red', 'G': 'Green', 'L': 'lavender', 'W': 'White'}\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "77", "problem": "Write a function to get the frequency of the elements in a list.", "completion": "\ndef freq_count(my_list):\n    frequency = {}\n    for item in my_list:\n        if item in frequency:\n            frequency[item] += 1\n        else:\n            frequency[item] = 1\n    return frequency\n\n\nassert freq_count([10,10,10,10,20,20,20,20,40,40,50,50,30])==({10: 4, 20: 4, 40: 2, 50: 2, 30: 1})\nassert freq_count([1,2,3,4,3,2,4,1,3,1,4])==({1:3, 2:2,3:3,4:3})\nassert freq_count([5,6,7,4,9,10,4,5,6,7,9,5])==({10:1,5:3,6:2,7:2,4:2,9:2})\n", "passed": true, "fail_reason": "[]"}
{"task_id": "78", "problem": "Write a function to find the closest smaller number than n.", "completion": "\ndef closest_num(n):\n    closest_low = 0\n    for i in range(len(arr)):\n        if num > arr[i] > closest_low:\n            closest_low = arr[i]\n    return closest_low\n\n\nassert closest_num(11) == 10\nassert closest_num(7) == 6\nassert closest_num(12) == 11\n", "passed": false, "fail_reason": "[NameError(\"name 'arr' is not defined\")]"}
{"task_id": "79", "problem": "Write a python function to find the length of the longest word.", "completion": "\ndef len_log(word_list):\n    longest_word = max(word_list, key=len)\n    longest_word_length = len(longest_word)\n    return longest_word_length\n\n\nassert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7\nassert len_log([\"a\",\"ab\",\"abc\"]) == 3\nassert len_log([\"small\",\"big\",\"tall\"]) == 5\n", "passed": true, "fail_reason": "[]"}
{"task_id": "80", "problem": "Write a function to check if a substring is present in a given list of string values.", "completion": "\ndef find_substring(string_list, substring):\n    for string in string_list:\n        if substring in string:\n            return True\n    return False\n\n\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"], \"ack\") == True\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"], \"abc\") == False\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"], \"ange\") == True\n", "passed": true, "fail_reason": "[]"}
{"task_id": "81", "problem": "Write a function to check whether the given number is undulating or not.", "completion": "\nimport math\n\ndef is_undulating(s):\n    \"\"\"\n    Returns True if the given string is undulating, False otherwise.\n    \"\"\"\n    # Convert the string to a list of integers\n    nums = [int(c) for c in s]\n\n    # Calculate the undulation for each number in the list\n    undulations = [math.sqrt(8 * x + 1) - 1 for x in nums]\n\n    # Check if any of the undulations are not integers\n    if any(not int(u) == u for u in undulations):\n        return False\n\n    # Check if the undulations are all positive\n    if all(u > 0 for u in undulations):\n        return True\n\n    # If the undulations are not all positive, check if they are all negative\n    if all(u < 0 for u in undulations):\n        return True\n\n    # If the undulations are not all positive or negative, return False\n    return False\n\n\nassert is_undulating(\"1212121\") == True\nassert is_undulating(\"1991\") == False\nassert is_undulating(\"121\") == True\n", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "82", "problem": "Write a function to calculate the value of 'a' to the power 'b'.", "completion": "\ndef power(a, b):\n    result = 1\n    for i in range(b):\n        result = result * a\n    return result\n", "passed": true, "fail_reason": "[]"}
{"task_id": "83", "problem": "Write a function to extract the index minimum value record from the given tuples.", "completion": "\ndef index_minimum(tpl):\n    min_value = tpl[0]\n    for i in tpl:\n        if i < min_value:\n            min_value = i\n    return min_value[0]\n\n\nassert index_minimum([('Rash', 143), ('Manjeet', 200), ('Varsha', 100)]) == 'Varsha'\n\n\nassert index_minimum([('Yash', 185), ('Dawood', 125), ('Sanya', 175)]) == 'Dawood'\n\n\nassert index_minimum([('Sai', 345), ('Salman', 145), ('Ayesha', 96)]) == 'Ayesha'\n\n\nassert index_minimum([('Sai', 345), ('Salman', 145), ('Ayesha', 96)]) == 'Ayesha'\n\n\nassert index_minimum([('Sai', 345), ('Salman', 145), ('Ayesha', 96)]) == 'Ayesha'\n", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "84", "problem": "Write a python function to find the minimum length of sublist.", "completion": "\ndef Find_Min_Length(my_list):\n    min_length = float('inf')\n    for sublist in my_list:\n        subsequence_length = len(sublist)\n        if subsequence_length < min_length:\n            min_length = subsequence_length\n    return min_length\n\n\nassert Find_Min_Length([[1],[1,2]]) == 1\nassert Find_Min_Length([[1,2],[1,2,3],[1,2,3,4]]) == 2\nassert Find_Min_Length([[3,3,3],[4,4,4,4]]) == 3\n", "passed": true, "fail_reason": "[]"}
