Download eval_benchmarks/mbpp_exec.jsonl from valueai-org/slwm-v4-eval-benchmarks: direct link, hf CLI and curl.
- Browser
- Download file 85.9 kB
-
https://huggingface.co/datasets/valueai-org/slwm-v4-eval-benchmarks/resolve/main/eval_benchmarks/mbpp_exec.jsonl
- Command line
-
hf download hf://datasets/valueai-org/slwm-v4-eval-benchmarks/eval_benchmarks/mbpp_exec.jsonl
-
curl -L -o mbpp_exec.jsonl https://huggingface.co/datasets/valueai-org/slwm-v4-eval-benchmarks/resolve/main/eval_benchmarks/mbpp_exec.jsonl
85.9 kB
| {"task_id": "11", "prompt": "# Write a python function to remove first and last occurrence of a given character from the string.\n", "test_code": "assert remove_Occ(\"hello\",\"l\") == \"heo\"\nassert remove_Occ(\"abcda\",\"a\") == \"bcd\"\nassert remove_Occ(\"PHP\",\"P\") == \"H\"\n"} | |
| {"task_id": "12", "prompt": "# Write a function to sort a given matrix in ascending order according to the sum of its rows.\n", "test_code": "assert 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"} | |
| {"task_id": "14", "prompt": "# Write a python function to find the volume of a triangular prism.\n", "test_code": "assert find_Volume(10,8,6) == 240\nassert find_Volume(3,2,2) == 6\nassert find_Volume(1,2,1) == 1\n"} | |
| {"task_id": "16", "prompt": "# Write a function to that returns true if the input string contains sequences of lowercase letters joined with an underscore and false otherwise.\n", "test_code": "assert text_lowercase_underscore(\"aab_cbbbc\")==(True)\nassert text_lowercase_underscore(\"aab_Abbbc\")==(False)\nassert text_lowercase_underscore(\"Aaab_abbbc\")==(False)\n"} | |
| {"task_id": "17", "prompt": "# Write a function that returns the perimeter of a square given its side length as input.\n", "test_code": "assert square_perimeter(10)==40\nassert square_perimeter(5)==20\nassert square_perimeter(4)==16\n"} | |
| {"task_id": "18", "prompt": "# Write a function to remove characters from the first string which are present in the second string.\n", "test_code": "assert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'\nassert remove_dirty_chars(\"digitalindia\", \"talent\") == 'digiidi'\nassert remove_dirty_chars(\"exoticmiles\", \"toxic\") == 'emles'\n"} | |
| {"task_id": "19", "prompt": "# Write a function to find whether a given array of integers contains any duplicate element.\n", "test_code": "assert test_duplicate(([1,2,3,4,5]))==False\nassert test_duplicate(([1,2,3,4, 4]))==True\nassert test_duplicate([1,1,2,2,3,3,4,4,5])==True\n"} | |
| {"task_id": "20", "prompt": "# Write a function to check if the given number is woodball or not.\n", "test_code": "assert is_woodall(383) == True\nassert is_woodall(254) == False\nassert is_woodall(200) == False\n"} | |
| {"task_id": "56", "prompt": "# Write a python function to check if a given number is one less than twice its reverse.\n", "test_code": "assert check(70) == False\nassert check(23) == False\nassert check(73) == True\n"} | |
| {"task_id": "57", "prompt": "# Write a python function to find the largest number that can be formed with the given list of digits.\n", "test_code": "assert find_Max_Num([1,2,3]) == 321\nassert find_Max_Num([4,5,6,1]) == 6541\nassert find_Max_Num([1,2,3,9]) == 9321\n"} | |
| {"task_id": "58", "prompt": "# Write a python function to check whether the given two integers have opposite sign or not.\n", "test_code": "assert opposite_Signs(1,-2) == True\nassert opposite_Signs(3,2) == False\nassert opposite_Signs(-10,-10) == False\nassert opposite_Signs(-2,2) == True\n"} | |
| {"task_id": "59", "prompt": "# Write a function to find the nth octagonal number.\n", "test_code": "assert is_octagonal(5) == 65\nassert is_octagonal(10) == 280\nassert is_octagonal(15) == 645\n"} | |
| {"task_id": "61", "prompt": "# Write a python function to count the number of substrings with the sum of digits equal to their length.\n", "test_code": "assert count_Substrings('112112') == 6\nassert count_Substrings('111') == 6\nassert count_Substrings('1101112') == 12\n"} | |
| {"task_id": "62", "prompt": "# Write a python function to find smallest number in a list.\n", "test_code": "assert smallest_num([10, 20, 1, 45, 99]) == 1\nassert smallest_num([1, 2, 3]) == 1\nassert smallest_num([45, 46, 50, 60]) == 45\n"} | |
| {"task_id": "63", "prompt": "# Write a function to find the maximum difference between available pairs in the given tuple list.\n", "test_code": "assert 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"} | |
| {"task_id": "64", "prompt": "# Write a function to sort a list of tuples using the second value of each tuple.\n", "test_code": "assert 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"} | |
| {"task_id": "65", "prompt": "# Write a function to flatten a list and sum all of its elements.\n", "test_code": "assert 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"} | |
| {"task_id": "66", "prompt": "# Write a python function to count the number of positive numbers in a list.\n", "test_code": "assert pos_count([1,-2,3,-4]) == 2\nassert pos_count([3,4,5,-1]) == 3\nassert pos_count([1,2,3,4]) == 4\n"} | |
| {"task_id": "67", "prompt": "# Write a function to find the number of ways to partition a set of Bell numbers.\n", "test_code": "assert bell_number(2)==2\nassert bell_number(10)==115975\nassert bell_number(56)==6775685320645824322581483068371419745979053216268760300\n"} | |
| {"task_id": "68", "prompt": "# Write a python function to check whether the given array is monotonic or not.\n", "test_code": "assert is_Monotonic([6, 5, 4, 4]) == True\nassert is_Monotonic([1, 2, 2, 3]) == True\nassert is_Monotonic([1, 3, 2]) == False\n"} | |
| {"task_id": "69", "prompt": "# Write a function to check whether a list contains the given sublist or not.\n", "test_code": "assert 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"} | |
| {"task_id": "70", "prompt": "# Write a function to find whether all the given tuples have equal length or not.\n", "test_code": "assert get_equal([(11, 22, 33), (44, 55, 66)]) == True\nassert get_equal([(1, 2, 3), (4, 5, 6, 7)]) == False\nassert get_equal([(1, 2), (3, 4)]) == True\n"} | |
| {"task_id": "71", "prompt": "# Write a function to sort a list of elements.\n", "test_code": "assert 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"} | |
| {"task_id": "72", "prompt": "# Write a python function to check whether the given number can be represented as the difference of two squares or not.\n", "test_code": "assert dif_Square(5) == True\nassert dif_Square(10) == False\nassert dif_Square(15) == True\n"} | |
| {"task_id": "74", "prompt": "# Write a function to check whether it follows the sequence given in the patterns array.\n", "test_code": "assert 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"} | |
| {"task_id": "75", "prompt": "# Write a function to find tuples which have all elements divisible by k from the given list of tuples.\n", "test_code": "assert 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"} | |
| {"task_id": "77", "prompt": "# Write a python function to find whether a number is divisible by 11.\n", "test_code": "assert is_Diff (12345) == False\nassert is_Diff(1212112) == True\nassert is_Diff(1212) == False\n"} | |
| {"task_id": "79", "prompt": "# Write a python function to check whether the length of the word is odd or not.\n", "test_code": "assert word_len(\"Hadoop\") == False\nassert word_len(\"great\") == True\nassert word_len(\"structure\") == True\n"} | |
| {"task_id": "80", "prompt": "# Write a function to find the nth tetrahedral number.\n", "test_code": "assert tetrahedral_number(5) == 35\nassert tetrahedral_number(6) == 56\nassert tetrahedral_number(7) == 84\n"} | |
| {"task_id": "82", "prompt": "# Write a function to find the volume of a sphere.\n", "test_code": "assert math.isclose(volume_sphere(10), 4188.790204786391, rel_tol=0.001)\nassert math.isclose(volume_sphere(25), 65449.84694978735, rel_tol=0.001)\nassert math.isclose(volume_sphere(20), 33510.32163829113, rel_tol=0.001)\n"} | |
| {"task_id": "83", "prompt": "# Write a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26.\n", "test_code": "assert get_Char(\"abc\") == \"f\"\nassert get_Char(\"gfg\") == \"t\"\nassert get_Char(\"ab\") == \"c\"\n"} | |
| {"task_id": "84", "prompt": "# Write a function to find the nth number in the newman conway sequence.\n", "test_code": "assert sequence(10) == 6\nassert sequence(2) == 1\nassert sequence(3) == 2\n"} | |
| {"task_id": "85", "prompt": "# Write a function to find the surface area of a sphere.\n", "test_code": "assert math.isclose(surfacearea_sphere(10), 1256.6370614359173, rel_tol=0.001)\nassert math.isclose(surfacearea_sphere(15), 2827.4333882308138, rel_tol=0.001)\nassert math.isclose(surfacearea_sphere(20), 5026.548245743669, rel_tol=0.001)\n"} | |
| {"task_id": "86", "prompt": "# Write a function to find nth centered hexagonal number.\n", "test_code": "assert centered_hexagonal_number(10) == 271\nassert centered_hexagonal_number(2) == 7\nassert centered_hexagonal_number(9) == 217\n"} | |
| {"task_id": "87", "prompt": "# Write a function to merge three dictionaries into a single dictionary.\n", "test_code": "assert 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"} | |
| {"task_id": "88", "prompt": "# Write a function to get the frequency of all the elements in a list, returned as a dictionary.\n", "test_code": "assert 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"} | |
| {"task_id": "89", "prompt": "# Write a function to find the closest smaller number than n.\n", "test_code": "assert closest_num(11) == 10\nassert closest_num(7) == 6\nassert closest_num(12) == 11\n"} | |
| {"task_id": "90", "prompt": "# Write a python function to find the length of the longest word.\n", "test_code": "assert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7\nassert len_log([\"a\",\"ab\",\"abc\"]) == 3\nassert len_log([\"small\",\"big\",\"tall\"]) == 5\n"} | |
| {"task_id": "91", "prompt": "# Write a function to check if a string is present as a substring in a given list of string values.\n", "test_code": "assert 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"} | |
| {"task_id": "92", "prompt": "# Write a function to check whether the given number is undulating or not.\n", "test_code": "assert is_undulating(1212121) == True\nassert is_undulating(1991) == False\nassert is_undulating(121) == True\n"} | |
| {"task_id": "93", "prompt": "# Write a function to calculate the value of 'a' to the power 'b'.\n", "test_code": "assert power(3,4) == 81\nassert power(2,3) == 8\nassert power(5,5) == 3125\n"} | |
| {"task_id": "94", "prompt": "# Given a list of tuples, write a function that returns the first value of the tuple with the smallest second value.\n", "test_code": "assert index_minimum([('Rash', 143), ('Manjeet', 200), ('Varsha', 100)]) == 'Varsha'\nassert index_minimum([('Yash', 185), ('Dawood', 125), ('Sanya', 175)]) == 'Dawood'\nassert index_minimum([('Sai', 345), ('Salman', 145), ('Ayesha', 96)]) == 'Ayesha'\n"} | |
| {"task_id": "95", "prompt": "# Write a python function to find the length of the smallest list in a list of lists.\n", "test_code": "assert 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"} | |
| {"task_id": "96", "prompt": "# Write a python function to find the number of divisors of a given integer.\n", "test_code": "assert divisor(15) == 4\nassert divisor(12) == 6\nassert divisor(9) == 3\n"} | |
| {"task_id": "97", "prompt": "# Write a function to find frequency of each element in a flattened list of lists, returned in a dictionary.\n", "test_code": "assert frequency_lists([[1, 2, 3, 2], [4, 5, 6, 2], [7, 8, 9, 5]])=={1: 1, 2: 3, 3: 1, 4: 1, 5: 2, 6: 1, 7: 1, 8: 1, 9: 1}\nassert frequency_lists([[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 frequency_lists([[20,30,40,17],[18,16,14,13],[10,20,30,40]])=={20:2,30:2,40:2,17: 1,18:1, 16: 1,14: 1,13: 1, 10: 1}\n"} | |
| {"task_id": "98", "prompt": "# Write a function to multiply all the numbers in a list and divide with the length of the list.\n", "test_code": "assert math.isclose(multiply_num((8, 2, 3, -1, 7)), -67.2, rel_tol=0.001)\nassert math.isclose(multiply_num((-10,-20,-30)), -2000.0, rel_tol=0.001)\nassert math.isclose(multiply_num((19,15,18)), 1710.0, rel_tol=0.001)\n"} | |
| {"task_id": "99", "prompt": "# Write a function to convert the given decimal number to its binary equivalent, represented as a string with no leading zeros.\n", "test_code": "assert decimal_to_binary(8) == '1000'\nassert decimal_to_binary(18) == '10010'\nassert decimal_to_binary(7) == '111'\n"} | |
| {"task_id": "100", "prompt": "# Write a function to find the next smallest palindrome of a specified integer, returned as an integer.\n", "test_code": "assert next_smallest_palindrome(99)==101\nassert next_smallest_palindrome(1221)==1331\nassert next_smallest_palindrome(120)==121\n"} | |
| {"task_id": "101", "prompt": "# Write a function to find the kth element in the given array using 1-based indexing.\n", "test_code": "assert kth_element([12,3,5,7,19], 2) == 3\nassert kth_element([17,24,8,23], 3) == 8\nassert kth_element([16,21,25,36,4], 4) == 36\n"} | |
| {"task_id": "102", "prompt": "# Write a function to convert a snake case string to camel case string.\n", "test_code": "assert snake_to_camel('python_program')=='PythonProgram'\nassert snake_to_camel('python_language')==('PythonLanguage')\nassert snake_to_camel('programming_language')==('ProgrammingLanguage')\n"} | |
| {"task_id": "103", "prompt": "# Write a function to find the Eulerian number a(n, m).\n", "test_code": "assert eulerian_num(3, 1) == 4\nassert eulerian_num(4, 1) == 11\nassert eulerian_num(5, 3) == 26\n"} | |
| {"task_id": "104", "prompt": "# Write a function to sort each sublist of strings in a given list of lists.\n", "test_code": "assert sort_sublists(([\"green\", \"orange\"], [\"black\", \"white\"], [\"white\", \"black\", \"orange\"]))==[['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]\nassert sort_sublists(([\" red \",\"green\" ],[\"blue \",\" black\"],[\" orange\",\"brown\"]))==[[' red ', 'green'], [' black', 'blue '], [' orange', 'brown']]\nassert sort_sublists(([\"zilver\",\"gold\"], [\"magnesium\",\"aluminium\"], [\"steel\", \"bronze\"]))==[['gold', 'zilver'],['aluminium', 'magnesium'], ['bronze', 'steel']]\n"} | |
| {"task_id": "105", "prompt": "# Write a python function to count true booleans in the given list.\n", "test_code": "assert count([True,False,True]) == 2\nassert count([False,False]) == 0\nassert count([True,True,True]) == 3\n"} | |
| {"task_id": "106", "prompt": "# Write a function to append the given list to the given tuples.\n", "test_code": "assert add_lists([5, 6, 7], (9, 10)) == (9, 10, 5, 6, 7)\nassert add_lists([6, 7, 8], (10, 11)) == (10, 11, 6, 7, 8)\nassert add_lists([7, 8, 9], (11, 12)) == (11, 12, 7, 8, 9)\n"} | |
| {"task_id": "108", "prompt": "# Write a function to merge three lists into a single sorted list.\n", "test_code": "assert merge_sorted_list([25, 24, 15, 4, 5, 29, 110],[19, 20, 11, 56, 25, 233, 154],[24, 26, 54, 48])==[4, 5, 11, 15, 19, 20, 24, 24, 25, 25, 26, 29, 48, 54, 56, 110, 154, 233]\nassert merge_sorted_list([1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12])==[1, 1, 2, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 11, 12]\nassert merge_sorted_list([18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1],[25, 35, 22, 85, 14, 65, 75, 25, 58],[12, 74, 9, 50, 61, 41])==[1, 2, 3, 4, 7, 8, 9, 9, 9, 10, 12, 14, 14, 18, 22, 25, 25, 35, 41, 50, 58, 61, 65, 74, 75, 85]\n"} | |
| {"task_id": "109", "prompt": "# Write a python function to find the number of numbers with an odd value when rotating a binary string the given number of times.\n", "test_code": "assert odd_Equivalent(\"011001\",6) == 3\nassert odd_Equivalent(\"11011\",5) == 4\nassert odd_Equivalent(\"1010\",4) == 2\n"} | |
| {"task_id": "111", "prompt": "# Write a function to find the common elements in given nested lists.\n", "test_code": "assert set(common_in_nested_lists([[12, 18, 23, 25, 45], [7, 12, 18, 24, 28], [1, 5, 8, 12, 15, 16, 18]]))==set([18, 12])\nassert set(common_in_nested_lists([[12, 5, 23, 25, 45], [7, 11, 5, 23, 28], [1, 5, 8, 18, 23, 16]]))==set([5,23])\nassert set(common_in_nested_lists([[2, 3,4, 1], [4, 5], [6,4, 8],[4, 5], [6, 8,4]]))==set([4])\n"} | |
| {"task_id": "113", "prompt": "# Write a function to check if a string represents an integer or not.\n", "test_code": "assert check_integer(\"python\")==False\nassert check_integer(\"1\")==True\nassert check_integer(\"12345\")==True\n"} | |
| {"task_id": "115", "prompt": "# Write a function to check whether all dictionaries in a list are empty or not.\n", "test_code": "assert empty_dit([{},{},{}])==True\nassert empty_dit([{1,2},{},{}])==False\nassert empty_dit({})==True\n"} | |
| {"task_id": "116", "prompt": "# Write a function to convert a given tuple of positive integers into a single integer.\n", "test_code": "assert tuple_to_int((1,2,3))==123\nassert tuple_to_int((4,5,6))==456\nassert tuple_to_int((5,6,7))==567\n"} | |
| {"task_id": "117", "prompt": "# Write a function to convert all possible convertible elements in a list of lists to floats.\n", "test_code": "assert list_to_float( [(\"3\", \"4\"), (\"1\", \"26.45\"), (\"7.32\", \"8\"), (\"4\", \"8\")] ) == [(3.0, 4.0), (1.0, 26.45), (7.32, 8.0), (4.0, 8.0)]\nassert list_to_float( [(\"4\", \"4\"), (\"2\", \"27\"), (\"4.12\", \"9\"), (\"7\", \"11\")] ) == [(4.0, 4.0), (2.0, 27.0), (4.12, 9.0), (7.0, 11.0)]\nassert list_to_float( [(\"6\", \"78\"), (\"5\", \"26.45\"), (\"1.33\", \"4\"), (\"82\", \"13\")] ) == [(6.0, 78.0), (5.0, 26.45), (1.33, 4.0), (82.0, 13.0)]\n"} | |
| {"task_id": "118", "prompt": "# Write a function to convert a string to a list of strings split on the space character.\n", "test_code": "assert string_to_list(\"python programming\")==['python','programming']\nassert string_to_list(\"lists tuples strings\")==['lists','tuples','strings']\nassert string_to_list(\"write a program\")==['write','a','program']\n"} | |
| {"task_id": "119", "prompt": "# Write a python function to find the element that appears only once in a sorted array.\n", "test_code": "assert search([1,1,2,2,3]) == 3\nassert search([1,1,3,3,4,4,5,5,7,7,8]) == 8\nassert search([1,2,2,3,3,4,4]) == 1\n"} | |
| {"task_id": "120", "prompt": "# Write a function to find the maximum absolute product between numbers in pairs of tuples within a given list.\n", "test_code": "assert max_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36\nassert max_product_tuple([(10,20), (15,2), (5,10)] )==200\nassert max_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==484\n"} | |
| {"task_id": "123", "prompt": "# Write a function to sum all amicable numbers from 1 to a specified number.\n", "test_code": "assert amicable_numbers_sum(999)==504\nassert amicable_numbers_sum(9999)==31626\nassert amicable_numbers_sum(99)==0\n"} | |
| {"task_id": "124", "prompt": "# Write a function to get the angle of a complex number.\n", "test_code": "assert math.isclose(angle_complex(0,1j), 1.5707963267948966, rel_tol=0.001)\nassert math.isclose(angle_complex(2,1j), 0.4636476090008061, rel_tol=0.001)\nassert math.isclose(angle_complex(0,2j), 1.5707963267948966, rel_tol=0.001)\n"} | |
| {"task_id": "125", "prompt": "# Write a function to find the maximum difference between the number of 0s and number of 1s in any sub-string of the given binary string.\n", "test_code": "assert find_length(\"11000010001\") == 6\nassert find_length(\"10111\") == 1\nassert find_length(\"11011101100101\") == 2\n"} | |
| {"task_id": "126", "prompt": "# Write a python function to find the sum of common divisors of two given numbers.\n", "test_code": "assert sum(10,15) == 6\nassert sum(100,150) == 93\nassert sum(4,6) == 3\n"} | |
| {"task_id": "127", "prompt": "# Write a function to multiply two integers.\n", "test_code": "assert multiply_int(10,20)==200\nassert multiply_int(5,10)==50\nassert multiply_int(4,8)==32\n"} | |
| {"task_id": "128", "prompt": "# Write a function to find words that are longer than n characters from a given list of words.\n", "test_code": "assert long_words(3,\"python is a programming language\")==['python','programming','language']\nassert long_words(2,\"writing a program\")==['writing','program']\nassert long_words(5,\"sorting list\")==['sorting']\n"} | |
| {"task_id": "129", "prompt": "# Write a function to calculate whether the matrix is a magic square.\n", "test_code": "assert magic_square_test([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]])==True\nassert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 8]])==True\nassert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 7]])==False\n"} | |
| {"task_id": "130", "prompt": "# Write a function to find the item with maximum frequency in a given list.\n", "test_code": "assert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,2,4,6,9,1,2])==2\nassert max_occurrences([2,3,8,4,7,9,8,7,9,15,14,10,12,13,16,18])==8\nassert max_occurrences([10,20,20,30,40,90,80,50,30,20,50,10])==20\n"} | |
| {"task_id": "131", "prompt": "# Write a python function to reverse only the vowels of a given string (where y is not a vowel).\n", "test_code": "assert reverse_vowels(\"Python\") == \"Python\"\nassert reverse_vowels(\"USA\") == \"ASU\"\nassert reverse_vowels(\"ab\") == \"ab\"\n"} | |
| {"task_id": "132", "prompt": "# Write a function to convert a tuple to a string.\n", "test_code": "assert tup_string(('e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's'))==(\"exercises\")\nassert tup_string(('p','y','t','h','o','n'))==(\"python\")\nassert tup_string(('p','r','o','g','r','a','m'))==(\"program\")\n"} | |
| {"task_id": "133", "prompt": "# Write a function to calculate the sum of the negative numbers of a given list of numbers.\n", "test_code": "assert sum_negativenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==-32\nassert sum_negativenum([10,15,-14,13,-18,12,-20])==-52\nassert sum_negativenum([19, -65, 57, 39, 152,-639, 121, 44, 90, -190])==-894\n"} | |
| {"task_id": "135", "prompt": "# Write a function to find the nth hexagonal number.\n", "test_code": "assert hexagonal_num(10) == 190\nassert hexagonal_num(5) == 45\nassert hexagonal_num(7) == 91\n"} | |
| {"task_id": "137", "prompt": "# Write a function to find the ratio of zeroes to non-zeroes in an array of integers.\n", "test_code": "assert math.isclose(zero_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8]), 0.181818, rel_tol=0.001)\nassert math.isclose(zero_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8]), 0.00, rel_tol=0.001)\nassert math.isclose(zero_count([2, 4, -6, -9, 11, -12, 14, -5, 17]), 0.00, rel_tol=0.001)\n"} | |
| {"task_id": "138", "prompt": "# Write a python function to check whether the given number can be represented as sum of non-zero powers of 2 or not.\n", "test_code": "assert is_Sum_Of_Powers_Of_Two(10) == True\nassert is_Sum_Of_Powers_Of_Two(7) == False\nassert is_Sum_Of_Powers_Of_Two(14) == True\n"} | |
| {"task_id": "139", "prompt": "# Write a function to find the circumference of a circle.\n", "test_code": "assert math.isclose(circle_circumference(10), 62.830000000000005, rel_tol=0.001)\nassert math.isclose(circle_circumference(5), 31.415000000000003, rel_tol=0.001)\nassert math.isclose(circle_circumference(4), 25.132, rel_tol=0.001)\n"} | |
| {"task_id": "140", "prompt": "# Write a function to flatten the list of lists into a single set of numbers.\n", "test_code": "assert set(extract_singly([(3, 4, 5), (4, 5, 7), (1, 4)])) == set([3, 4, 5, 7, 1])\nassert set(extract_singly([(1, 2, 3), (4, 2, 3), (7, 8)])) == set([1, 2, 3, 4, 7, 8])\nassert set(extract_singly([(7, 8, 9), (10, 11, 12), (10, 11)])) == set([7, 8, 9, 10, 11, 12])\n"} | |
| {"task_id": "141", "prompt": "# Write a function to sort a list of elements.\n", "test_code": "assert pancake_sort([15, 79, 25, 38, 69]) == [15, 25, 38, 69, 79]\nassert pancake_sort([98, 12, 54, 36, 85]) == [12, 36, 54, 85, 98]\nassert pancake_sort([41, 42, 32, 12, 23]) == [12, 23, 32, 41, 42]\n"} | |
| {"task_id": "142", "prompt": "# Write a function to count number items that are identical in the same position of three given lists.\n", "test_code": "assert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,9],[2,1,3,1,2,6,7,9])==3\nassert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,8],[2,1,3,1,2,6,7,8])==4\nassert count_samepair([1,2,3,4,2,6,7,8],[2,2,3,1,2,6,7,8],[2,1,3,1,2,6,7,8])==5\n"} | |
| {"task_id": "143", "prompt": "# Write a function to find number of lists present in the given tuple.\n", "test_code": "assert find_lists(([1, 2, 3, 4], [5, 6, 7, 8])) == 2\nassert find_lists(([1, 2], [3, 4], [5, 6])) == 3\nassert find_lists(([9, 8, 7, 6, 5, 4, 3, 2, 1])) == 1\n"} | |
| {"task_id": "145", "prompt": "# Write a python function to find the maximum difference between any two elements in a given array.\n", "test_code": "assert max_Abs_Diff((2,1,5,3)) == 4\nassert max_Abs_Diff((9,3,2,5,1)) == 8\nassert max_Abs_Diff((3,2,1)) == 2\n"} | |
| {"task_id": "160", "prompt": "# Write a function that returns integers x and y that satisfy ax + by = n as a tuple, or return None if no solution exists.\n", "test_code": "assert find_solution(2, 3, 7) == (2, 1)\nassert find_solution(4, 2, 7) == None\nassert find_solution(1, 13, 17) == (4, 1)\n"} | |
| {"task_id": "161", "prompt": "# Write a function to remove all elements from a given list present in another list.\n", "test_code": "assert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8]) == [1, 3, 5, 7, 9, 10]\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7]) == [2, 4, 6, 8, 9, 10]\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [5, 7]) == [1, 2, 3, 4, 6, 8, 9, 10]\n"} | |
| {"task_id": "162", "prompt": "# Write a function to calculate the sum (n - 2*i) from i=0 to n // 2, for instance n + (n-2) + (n-4)... (until n-x =< 0).\n", "test_code": "assert sum_series(6) == 12\nassert sum_series(10) == 30\nassert sum_series(9) == 25\n"} | |
| {"task_id": "163", "prompt": "# Write a function to calculate the area of a regular polygon given the length and number of its sides.\n", "test_code": "assert math.isclose(area_polygon(4, 20), 400., rel_tol=0.001)\nassert math.isclose(area_polygon(10, 15), 1731.197, rel_tol=0.001)\nassert math.isclose(area_polygon(9, 7), 302.909, rel_tol=0.001)\n"} | |
| {"task_id": "164", "prompt": "# Write a function to determine if the sum of the divisors of two integers are the same.\n", "test_code": "assert are_equivalent(36, 57) == False\nassert are_equivalent(2, 4) == False\nassert are_equivalent(23, 47) == True\n"} | |
| {"task_id": "165", "prompt": "# Write a function to count the number of characters in a string that occur at the same position in the string as in the English alphabet (case insensitive).\n", "test_code": "assert count_char_position(\"xbcefg\") == 2\nassert count_char_position(\"ABcED\") == 3\nassert count_char_position(\"AbgdeF\") == 5\n"} | |
| {"task_id": "166", "prompt": "# Write a function that counts the number of pairs of integers in a list that xor to an even number.\n", "test_code": "assert find_even_pair([5, 4, 7, 2, 1]) == 4\nassert find_even_pair([7, 2, 8, 1, 0, 5, 11]) == 9\nassert find_even_pair([1, 2, 3]) == 1\n"} | |
| {"task_id": "167", "prompt": "# Write a python function to find the smallest power of 2 greater than or equal to n.\n", "test_code": "assert next_power_of_2(0) == 1\nassert next_power_of_2(5) == 8\nassert next_power_of_2(17) == 32\n"} | |
| {"task_id": "168", "prompt": "# Write a function to count the number of occurrences of a number in a given list.\n", "test_code": "assert frequency([1,2,3], 4) == 0\nassert frequency([1,2,2,3,3,3,4], 3) == 3\nassert frequency([0,1,2,3,1,2], 1) == 2\n"} | |
| {"task_id": "170", "prompt": "# Write a function to find the sum of numbers in a list within a range specified by two indices.\n", "test_code": "assert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 8, 10) == 29\nassert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 5, 7) == 16\nassert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 7, 10) == 38\n"} | |
| {"task_id": "171", "prompt": "# Write a function to find the perimeter of a regular pentagon from the length of its sides.\n", "test_code": "assert perimeter_pentagon(5) == 25\nassert perimeter_pentagon(10) == 50\nassert perimeter_pentagon(15) == 75\n"} | |
| {"task_id": "172", "prompt": "# Write a function to count the number of occurence of the string 'std' in a given string.\n", "test_code": "assert count_occurance(\"letstdlenstdporstd\") == 3\nassert count_occurance(\"truststdsolensporsd\") == 1\nassert count_occurance(\"makestdsostdworthit\") == 2\nassert count_occurance(\"stds\") == 1\nassert count_occurance(\"\") == 0\n"} | |
| {"task_id": "222", "prompt": "# Write a function to check if all the elements in tuple have same data type or not.\n", "test_code": "assert check_type((5, 6, 7, 3, 5, 6) ) == True\nassert check_type((1, 2, \"4\") ) == False\nassert check_type((3, 2, 1, 4, 5) ) == True\n"} | |
| {"task_id": "223", "prompt": "# Write a function that takes in a sorted array, its length (n), and an element and returns whether the element is the majority element in the given sorted array. (The majority element is the element that occurs more than n/2 times.)\n", "test_code": "assert is_majority([1, 2, 3, 3, 3, 3, 10], 7, 3) == True\nassert is_majority([1, 1, 2, 4, 4, 4, 6, 6], 8, 4) == False\nassert is_majority([1, 1, 1, 2, 2], 5, 1) == True\nassert is_majority([1, 1, 2, 2], 5, 1) == False\n"} | |
| {"task_id": "224", "prompt": "# Write a python function to count the number of set bits (binary digits with value 1) in a given number.\n", "test_code": "assert count_Set_Bits(2) == 1\nassert count_Set_Bits(4) == 1\nassert count_Set_Bits(6) == 2\n"} | |
| {"task_id": "226", "prompt": "# Write a python function to remove the characters which have odd index values of a given string.\n", "test_code": "assert odd_values_string('abcdef') == 'ace'\nassert odd_values_string('python') == 'pto'\nassert odd_values_string('data') == 'dt'\nassert odd_values_string('lambs') == 'lms'\n"} | |
| {"task_id": "227", "prompt": "# Write a function to find minimum of three numbers.\n", "test_code": "assert min_of_three(10,20,0)==0\nassert min_of_three(19,15,18)==15\nassert min_of_three(-10,-20,-30)==-30\n"} | |
| {"task_id": "228", "prompt": "# Write a python function to check whether all the bits are unset in the given range or not.\n", "test_code": "assert all_Bits_Set_In_The_Given_Range(4,1,2) == True\nassert all_Bits_Set_In_The_Given_Range(17,2,4) == True\nassert all_Bits_Set_In_The_Given_Range(39,4,6) == False\n"} | |
| {"task_id": "229", "prompt": "# Write a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved.\n", "test_code": "assert re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]\nassert re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]\nassert re_arrange_array([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85]\n"} | |
| {"task_id": "230", "prompt": "# Write a function that takes in a string and character, replaces blank spaces in the string with the character, and returns the string.\n", "test_code": "assert replace_blank(\"hello people\",'@')==(\"hello@people\")\nassert replace_blank(\"python program language\",'$')==(\"python$program$language\")\nassert replace_blank(\"blank space\",\"-\")==(\"blank-space\")\n"} | |
| {"task_id": "232", "prompt": "# Write a function that takes in a list and an integer n and returns a list containing the n largest items from the list.\n", "test_code": "assert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],2))==set([100,90])\nassert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],5))==set([100,90,80,70,60])\nassert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],3))==set([100,90,80])\n"} | |
| {"task_id": "233", "prompt": "# Write a function to find the lateral surface area of a cylinder.\n", "test_code": "assert math.isclose(lateralsuface_cylinder(10,5), 314.15000000000003, rel_tol=0.001)\nassert math.isclose(lateralsuface_cylinder(4,5), 125.66000000000001, rel_tol=0.001)\nassert math.isclose(lateralsuface_cylinder(4,10), 251.32000000000002, rel_tol=0.001)\n"} | |
| {"task_id": "234", "prompt": "# Write a function to find the volume of a cube given its side length.\n", "test_code": "assert volume_cube(3)==27\nassert volume_cube(2)==8\nassert volume_cube(5)==125\n"} | |
| {"task_id": "235", "prompt": "# Write a python function to set all even bits of a given number.\n", "test_code": "assert even_bit_set_number(10) == 10\nassert even_bit_set_number(20) == 30\nassert even_bit_set_number(30) == 30\n"} | |
| {"task_id": "237", "prompt": "# Write a function that takes in a list of tuples and returns a dictionary mapping each unique tuple to the number of times it occurs in the list.\n", "test_code": "assert check_occurences([(3, 1), (1, 3), (2, 5), (5, 2), (6, 3)] ) == {(1, 3): 2, (2, 5): 2, (3, 6): 1}\nassert check_occurences([(4, 2), (2, 4), (3, 6), (6, 3), (7, 4)] ) == {(2, 4): 2, (3, 6): 2, (4, 7): 1}\nassert check_occurences([(13, 2), (11, 23), (12, 25), (25, 12), (16, 23)] ) == {(2, 13): 1, (11, 23): 1, (12, 25): 2, (16, 23): 1}\n"} | |
| {"task_id": "238", "prompt": "# Write a python function to count the number of non-empty substrings of a given string.\n", "test_code": "assert number_of_substrings(\"abc\") == 6\nassert number_of_substrings(\"abcd\") == 10\nassert number_of_substrings(\"abcde\") == 15\n"} | |
| {"task_id": "239", "prompt": "# Write a function that takes in positive integers m and n and finds the number of possible sequences of length n, such that each element is a positive integer and is greater than or equal to twice the previous element but less than or equal to m.\n", "test_code": "assert get_total_number_of_sequences(10, 4) == 4\nassert get_total_number_of_sequences(5, 2) == 6\nassert get_total_number_of_sequences(16, 3) == 84\n"} | |
| {"task_id": "240", "prompt": "# Write a function that takes in two lists and replaces the last element of the first list with the elements of the second list.\n", "test_code": "assert replace_list([1, 3, 5, 7, 9, 10],[2, 4, 6, 8])==[1, 3, 5, 7, 9, 2, 4, 6, 8]\nassert replace_list([1,2,3,4,5],[5,6,7,8])==[1,2,3,4,5,6,7,8]\nassert replace_list([\"red\",\"blue\",\"green\"],[\"yellow\"])==[\"red\",\"blue\",\"yellow\"]\n"} | |
| {"task_id": "242", "prompt": "# Write a function to count the total number of characters in a string.\n", "test_code": "assert count_charac(\"python programming\")==18\nassert count_charac(\"language\")==8\nassert count_charac(\"words\")==5\n"} | |
| {"task_id": "244", "prompt": "# Write a python function to find the next perfect square greater than a given number.\n", "test_code": "assert next_Perfect_Square(35) == 36\nassert next_Perfect_Square(6) == 9\nassert next_Perfect_Square(9) == 16\n"} | |
| {"task_id": "245", "prompt": "# Write a function that takes an array and finds the maximum sum of a bitonic subsequence for the given array, where a sequence is bitonic if it is first increasing and then decreasing.\n", "test_code": "assert max_sum([1, 15, 51, 45, 33, 100, 12, 18, 9]) == 194\nassert max_sum([80, 60, 30, 40, 20, 10]) == 210\nassert max_sum([2, 3 ,14, 16, 21, 23, 29, 30]) == 138\n"} | |
| {"task_id": "246", "prompt": "# Write a function for computing square roots using the babylonian method.\n", "test_code": "assert math.isclose(babylonian_squareroot(10), 3.162277660168379, rel_tol=0.001)\nassert math.isclose(babylonian_squareroot(2), 1.414213562373095, rel_tol=0.001)\nassert math.isclose(babylonian_squareroot(9), 3.0, rel_tol=0.001)\n"} | |
| {"task_id": "247", "prompt": "# Write a function to find the length of the longest palindromic subsequence in the given string.\n", "test_code": "assert lps(\"TENS FOR TENS\") == 5\nassert lps(\"CARDIO FOR CARDS\") == 7\nassert lps(\"PART OF THE JOURNEY IS PART\") == 9\n"} | |
| {"task_id": "248", "prompt": "# Write a function that takes in an integer n and calculates the harmonic sum of n-1.\n", "test_code": "assert math.isclose(harmonic_sum(7), 2.5928571428571425, rel_tol=0.001)\nassert math.isclose(harmonic_sum(4), 2.083333333333333, rel_tol=0.001)\nassert math.isclose(harmonic_sum(19), 3.547739657143682, rel_tol=0.001)\n"} | |
| {"task_id": "249", "prompt": "# Write a function to find the intersection of two arrays.\n", "test_code": "assert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[1, 2, 4, 8, 9])==[1, 2, 8, 9]\nassert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[3,5,7,9])==[3,5,7,9]\nassert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[10,20,30,40])==[10]\n"} | |
| {"task_id": "250", "prompt": "# Write a python function that takes in a tuple and an element and counts the occcurences of the element in the tuple.\n", "test_code": "assert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),4) == 0\nassert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),10) == 3\nassert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),8) == 4\n"} | |
| {"task_id": "251", "prompt": "# Write a function that takes in a list and an element and inserts the element before each element in the list, and returns the resulting list.\n", "test_code": "assert insert_element(['Red', 'Green', 'Black'] ,'c')==['c', 'Red', 'c', 'Green', 'c', 'Black']\nassert insert_element(['python', 'java'] ,'program')==['program', 'python', 'program', 'java']\nassert insert_element(['happy', 'sad'] ,'laugh')==['laugh', 'happy', 'laugh', 'sad']\n"} | |
| {"task_id": "252", "prompt": "# Write a python function to convert complex numbers to polar coordinates.\n", "test_code": "assert convert(1) == (1.0, 0.0)\nassert convert(4) == (4.0,0.0)\nassert convert(5) == (5.0,0.0)\n"} | |
| {"task_id": "253", "prompt": "# Write a python function that returns the number of integer elements in a given list.\n", "test_code": "assert count_integer([1,2,'abc',1.2]) == 2\nassert count_integer([1,2,3]) == 3\nassert count_integer([1,1.2,4,5.1]) == 2\n"} | |
| {"task_id": "255", "prompt": "# Write a function that takes in a list and length n, and generates all combinations (with repetition) of the elements of the list and returns a list with a tuple for each combination.\n", "test_code": "assert combinations_colors( [\"Red\",\"Green\",\"Blue\"],1)==[('Red',), ('Green',), ('Blue',)]\nassert combinations_colors( [\"Red\",\"Green\",\"Blue\"],2)==[('Red', 'Red'), ('Red', 'Green'), ('Red', 'Blue'), ('Green', 'Green'), ('Green', 'Blue'), ('Blue', 'Blue')]\nassert combinations_colors( [\"Red\",\"Green\",\"Blue\"],3)==[('Red', 'Red', 'Red'), ('Red', 'Red', 'Green'), ('Red', 'Red', 'Blue'), ('Red', 'Green', 'Green'), ('Red', 'Green', 'Blue'), ('Red', 'Blue', 'Blue'), ('Green', 'Green', 'Green'), ('Green', 'Green', 'Blue'), ('Green', 'Blue', 'Blue'), ('Blue', 'Blue', 'Blue')]\n"} | |
| {"task_id": "256", "prompt": "# Write a python function that takes in a non-negative number and returns the number of prime numbers less than the given non-negative number.\n", "test_code": "assert count_Primes_nums(5) == 2\nassert count_Primes_nums(10) == 4\nassert count_Primes_nums(100) == 25\n"} | |
| {"task_id": "257", "prompt": "# Write a function that takes in two numbers and returns a tuple with the second number and then the first number.\n", "test_code": "assert swap_numbers(10,20)==(20,10)\nassert swap_numbers(15,17)==(17,15)\nassert swap_numbers(100,200)==(200,100)\n"} | |
| {"task_id": "259", "prompt": "# Write a function to maximize the given two tuples.\n", "test_code": "assert maximize_elements(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((6, 7), (4, 9), (2, 9), (7, 10))\nassert maximize_elements(((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))) == ((7, 8), (5, 10), (3, 10), (8, 11))\nassert maximize_elements(((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))) == ((8, 9), (6, 11), (4, 11), (9, 12))\n"} | |
| {"task_id": "260", "prompt": "# Write a function to find the nth newman\u2013shanks\u2013williams prime number.\n", "test_code": "assert newman_prime(3) == 7\nassert newman_prime(4) == 17\nassert newman_prime(5) == 41\n"} | |
| {"task_id": "261", "prompt": "# Write a function that takes in two tuples and performs mathematical division operation element-wise across the given tuples.\n", "test_code": "assert division_elements((10, 4, 6, 9),(5, 2, 3, 3)) == (2, 2, 2, 3)\nassert division_elements((12, 6, 8, 16),(6, 3, 4, 4)) == (2, 2, 2, 4)\nassert division_elements((20, 14, 36, 18),(5, 7, 6, 9)) == (4, 2, 6, 2)\n"} | |
| {"task_id": "262", "prompt": "# Write a function that takes in a list and an integer L and splits the given list into two parts where the length of the first part of the list is L, and returns the resulting lists in a tuple.\n", "test_code": "assert split_two_parts([1,1,2,3,4,4,5,1],3)==([1, 1, 2], [3, 4, 4, 5, 1])\nassert split_two_parts(['a', 'b', 'c', 'd'],2)==(['a', 'b'], ['c', 'd'])\nassert split_two_parts(['p', 'y', 't', 'h', 'o', 'n'],4)==(['p', 'y', 't', 'h'], ['o', 'n'])\n"} | |
| {"task_id": "264", "prompt": "# Write a function to calculate a dog's age in dog's years.\n", "test_code": "assert dog_age(12)==61\nassert dog_age(15)==73\nassert dog_age(24)==109\n"} | |
| {"task_id": "265", "prompt": "# Write a function that takes in a list and an integer n and splits a list for every nth element, returning a list of the resulting lists.\n", "test_code": "assert list_split(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'],3)==[['a', 'd', 'g', 'j', 'm'], ['b', 'e', 'h', 'k', 'n'], ['c', 'f', 'i', 'l']]\nassert list_split([1,2,3,4,5,6,7,8,9,10,11,12,13,14],3)==[[1,4,7,10,13], [2,5,8,11,14], [3,6,9,12]]\nassert list_split(['python','java','C','C++','DBMS','SQL'],2)==[['python', 'C', 'DBMS'], ['java', 'C++', 'SQL']]\n"} | |
| {"task_id": "266", "prompt": "# Write a function to find the lateral surface area of a cube given its side length.\n", "test_code": "assert lateralsurface_cube(5)==100\nassert lateralsurface_cube(9)==324\nassert lateralsurface_cube(10)==400\n"} | |
| {"task_id": "267", "prompt": "# Write a python function that takes in an integer n and returns the sum of the squares of the first n odd natural numbers.\n", "test_code": "assert square_Sum(2) == 10\nassert square_Sum(3) == 35\nassert square_Sum(4) == 84\n"} | |
| {"task_id": "268", "prompt": "# Write a function to find the n'th star number.\n", "test_code": "assert find_star_num(3) == 37\nassert find_star_num(4) == 73\nassert find_star_num(5) == 121\n"} | |
| {"task_id": "269", "prompt": "# Write a function to find the ascii value of a character.\n", "test_code": "assert ascii_value('A')==65\nassert ascii_value('R')==82\nassert ascii_value('S')==83\n"} | |
| {"task_id": "270", "prompt": "# Write a python function to find the sum of even numbers at even positions of a list.\n", "test_code": "assert sum_even_and_even_index([5, 6, 12, 1, 18, 8]) == 30\nassert sum_even_and_even_index([3, 20, 17, 9, 2, 10, 18, 13, 6, 18]) == 26\nassert sum_even_and_even_index([5, 6, 12, 1]) == 12\n"} | |
| {"task_id": "271", "prompt": "# Write a python function that takes in an integer n and finds the sum of the first n even natural numbers that are raised to the fifth power.\n", "test_code": "assert even_Power_Sum(2) == 1056\nassert even_Power_Sum(3) == 8832\nassert even_Power_Sum(1) == 32\n"} | |
| {"task_id": "272", "prompt": "# Write a function that takes in a list of tuples and returns a list containing the rear element of each tuple.\n", "test_code": "assert rear_extract([(1, 'Rash', 21), (2, 'Varsha', 20), (3, 'Kil', 19)]) == [21, 20, 19]\nassert rear_extract([(1, 'Sai', 36), (2, 'Ayesha', 25), (3, 'Salman', 45)]) == [36, 25, 45]\nassert rear_extract([(1, 'Sudeep', 14), (2, 'Vandana', 36), (3, 'Dawood', 56)]) == [14, 36, 56]\n"} | |
| {"task_id": "273", "prompt": "# Write a function that takes in two tuples and subtracts the elements of the first tuple by the elements of the second tuple with the same index.\n", "test_code": "assert substract_elements((10, 4, 5), (2, 5, 18)) == (8, -1, -13)\nassert substract_elements((11, 2, 3), (24, 45 ,16)) == (-13, -43, -13)\nassert substract_elements((7, 18, 9), (10, 11, 12)) == (-3, 7, -3)\n"} | |
| {"task_id": "274", "prompt": "# Write a python function that takes in a positive integer n and finds the sum of even index binomial coefficients.\n", "test_code": "assert even_binomial_Coeff_Sum(4) == 8\nassert even_binomial_Coeff_Sum(6) == 32\nassert even_binomial_Coeff_Sum(2) == 2\n"} | |
| {"task_id": "276", "prompt": "# Write a function that takes in the radius and height of a cylinder and returns the the volume.\n", "test_code": "assert math.isclose(volume_cylinder(10,5), 1570.7500000000002, rel_tol=0.001)\nassert math.isclose(volume_cylinder(4,5), 251.32000000000002, rel_tol=0.001)\nassert math.isclose(volume_cylinder(4,10), 502.64000000000004, rel_tol=0.001)\n"} | |
| {"task_id": "277", "prompt": "# Write a function that takes in a dictionary and integer n and filters the dictionary to only include entries with values greater than or equal to n.\n", "test_code": "assert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},170)=={'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}\nassert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},180)=={ 'Alden Cantrell': 180, 'Pierre Cox': 190}\nassert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},190)=={ 'Pierre Cox': 190}\n"} | |
| {"task_id": "278", "prompt": "# Write a function to find the number of elements that occurs before the tuple element in the given tuple.\n", "test_code": "assert count_first_elements((1, 5, 7, (4, 6), 10) ) == 3\nassert count_first_elements((2, 9, (5, 7), 11) ) == 2\nassert count_first_elements((11, 15, 5, 8, (2, 3), 8) ) == 4\n"} | |
| {"task_id": "279", "prompt": "# Write a function to find the nth decagonal number.\n", "test_code": "assert is_num_decagonal(3) == 27\nassert is_num_decagonal(7) == 175\nassert is_num_decagonal(10) == 370\n"} | |
| {"task_id": "280", "prompt": "# Write a function that takes in an array and element and returns a tuple containing a boolean that indicates if the element is in the array and the index position of the element (or -1 if the element is not found).\n", "test_code": "assert sequential_search([11,23,58,31,56,77,43,12,65,19],31) == (True, 3)\nassert sequential_search([12, 32, 45, 62, 35, 47, 44, 61],61) == (True, 7)\nassert sequential_search([9, 10, 17, 19, 22, 39, 48, 56],48) == (True, 6)\n"} | |
| {"task_id": "281", "prompt": "# Write a python function to check if the elements of a given list are unique or not.\n", "test_code": "assert all_unique([1,2,3]) == True\nassert all_unique([1,2,1,2]) == False\nassert all_unique([1,2,3,4,5]) == True\n"} | |
| {"task_id": "282", "prompt": "# Write a function to subtract two lists element-wise.\n", "test_code": "assert sub_list([1, 2, 3],[4,5,6])==[-3,-3,-3]\nassert sub_list([1,2],[3,4])==[-2,-2]\nassert sub_list([90,120],[50,70])==[40,50]\n"} | |
| {"task_id": "283", "prompt": "# Write a python function takes in an integer and check whether the frequency of each digit in the integer is less than or equal to the digit itself.\n", "test_code": "assert validate(1234) == True\nassert validate(51241) == False\nassert validate(321) == True\n"} | |
| {"task_id": "284", "prompt": "# Write a function that takes in a list and element and checks whether all items in the list are equal to the given element.\n", "test_code": "assert check_element([\"green\", \"orange\", \"black\", \"white\"],'blue')==False\nassert check_element([1,2,3,4],7)==False\nassert check_element([\"green\", \"green\", \"green\", \"green\"],'green')==True\n"} | |
| {"task_id": "285", "prompt": "# Write a function that checks whether a string contains the 'a' character followed by two or three 'b' characters.\n", "test_code": "assert text_match_two_three(\"ac\")==(False)\nassert text_match_two_three(\"dc\")==(False)\nassert text_match_two_three(\"abbbba\")==(True)\n"} | |
| {"task_id": "286", "prompt": "# Write a function to find the largest sum of a contiguous array in the modified array which is formed by repeating the given array k times.\n", "test_code": "assert max_sub_array_sum_repeated([10, 20, -30, -1], 4, 3) == 30\nassert max_sub_array_sum_repeated([-1, 10, 20], 3, 2) == 59\nassert max_sub_array_sum_repeated([-1, -2, -3], 3, 3) == -1\n"} | |
| {"task_id": "287", "prompt": "# Write a python function takes in an integer n and returns the sum of squares of first n even natural numbers.\n", "test_code": "assert square_Sum(2) == 20\nassert square_Sum(3) == 56\nassert square_Sum(4) == 120\n"} | |
| {"task_id": "290", "prompt": "# Write a function to find the list of maximum length in a list of lists.\n", "test_code": "assert max_length([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(3, [13, 15, 17])\nassert max_length([[1], [5, 7], [10, 12, 14,15]])==(4, [10, 12, 14,15])\nassert max_length([[5], [15,20,25]])==(3, [15,20,25])\n"} | |
| {"task_id": "291", "prompt": "# Write a function to find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n posts and k colors.\n", "test_code": "assert count_no_of_ways(2, 4) == 16\nassert count_no_of_ways(3, 2) == 6\nassert count_no_of_ways(4, 4) == 228\n"} | |
| {"task_id": "292", "prompt": "# Write a python function to find quotient of two numbers (rounded down to the nearest integer).\n", "test_code": "assert find(10,3) == 3\nassert find(4,2) == 2\nassert find(20,5) == 4\n"} | |
| {"task_id": "293", "prompt": "# Write a function to find the third side of a right angled triangle.\n", "test_code": "assert otherside_rightangle(7,8)==10.63014581273465\nassert otherside_rightangle(3,4)==5\nassert otherside_rightangle(7,15)==16.55294535724685\n"} | |
| {"task_id": "294", "prompt": "# Write a function to find the maximum value in a given heterogeneous list.\n", "test_code": "assert max_val(['Python', 3, 2, 4, 5, 'version'])==5\nassert max_val(['Python', 15, 20, 25])==25\nassert max_val(['Python', 30, 20, 40, 50, 'version'])==50\n"} | |
| {"task_id": "295", "prompt": "# Write a function to return the sum of all divisors of a number.\n", "test_code": "assert sum_div(8)==7\nassert sum_div(12)==16\nassert sum_div(7)==1\n"} | |
| {"task_id": "296", "prompt": "# Write a python function to count inversions in an array.\n", "test_code": "assert get_Inv_Count([1,20,6,4,5]) == 5\nassert get_Inv_Count([1,2,1]) == 1\nassert get_Inv_Count([1,2,5,6,1]) == 3\n"} | |
| {"task_id": "297", "prompt": "# Write a function to flatten a given nested list structure.\n", "test_code": "assert flatten_list([0, 10, [20, 30], 40, 50, [60, 70, 80], [90, 100, 110, 120]])==[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]\nassert flatten_list([[10, 20], [40], [30, 56, 25], [10, 20], [33], [40]])==[10, 20, 40, 30, 56, 25, 10, 20, 33, 40]\nassert flatten_list([[1,2,3], [4,5,6], [10,11,12], [7,8,9]])==[1, 2, 3, 4, 5, 6, 10, 11, 12, 7, 8, 9]\n"} | |
| {"task_id": "299", "prompt": "# Write a function to calculate the maximum aggregate from the list of tuples.\n", "test_code": "assert max_aggregate([('Juan Whelan',90),('Sabah Colley',88),('Peter Nichols',7),('Juan Whelan',122),('Sabah Colley',84)])==('Juan Whelan', 212)\nassert max_aggregate([('Juan Whelan',50),('Sabah Colley',48),('Peter Nichols',37),('Juan Whelan',22),('Sabah Colley',14)])==('Juan Whelan', 72)\nassert max_aggregate([('Juan Whelan',10),('Sabah Colley',20),('Peter Nichols',30),('Juan Whelan',40),('Sabah Colley',50)])==('Sabah Colley', 70)\n"} | |
| {"task_id": "300", "prompt": "# Write a function to find the count of all binary sequences of length 2n such that sum of first n bits is same as sum of last n bits.\n", "test_code": "assert math.isclose(count_binary_seq(1), 2.0, rel_tol=0.001)\nassert math.isclose(count_binary_seq(2), 6.0, rel_tol=0.001)\nassert math.isclose(count_binary_seq(3), 20.0, rel_tol=0.001)\n"} | |
| {"task_id": "301", "prompt": "# Write a function to find the depth of a dictionary.\n", "test_code": "assert dict_depth({'a':1, 'b': {'c': {'d': {}}}})==4\nassert dict_depth({'a':1, 'b': {'c':'python'}})==2\nassert dict_depth({1: 'Sun', 2: {3: {4:'Mon'}}})==3\n"} | |
| {"task_id": "304", "prompt": "# Write a python function to find element at a given index after number of rotations.\n", "test_code": "assert find_Element([1,2,3,4,5],[[0,2],[0,3]],2,1) == 3\nassert find_Element([1,2,3,4],[[0,1],[0,2]],1,2) == 3\nassert find_Element([1,2,3,4,5,6],[[0,1],[0,2]],1,1) == 1\n"} | |
| {"task_id": "305", "prompt": "# Write a function to return two words from a list of words starting with letter 'p'.\n", "test_code": "assert start_withp([\"Python PHP\", \"Java JavaScript\", \"c c++\"])==('Python', 'PHP')\nassert start_withp([\"Python Programming\",\"Java Programming\"])==('Python','Programming')\nassert start_withp([\"Pqrst Pqr\",\"qrstuv\"])==('Pqrst','Pqr')\n"} | |
| {"task_id": "306", "prompt": "# Write a function to find the maximum sum of increasing subsequence from prefix until ith index and also including a given kth element which is after i, i.e., k > i .\n", "test_code": "assert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 4, 6) == 11\nassert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 2, 5) == 7\nassert max_sum_increasing_subseq([11, 15, 19, 21, 26, 28, 31], 7, 2, 4) == 71\n"} | |
| {"task_id": "307", "prompt": "# Write a function to get a colon of a tuple.\n", "test_code": "assert colon_tuplex((\"HELLO\", 5, [], True) ,2,50)==(\"HELLO\", 5, [50], True)\nassert colon_tuplex((\"HELLO\", 5, [], True) ,2,100)==((\"HELLO\", 5, [100],True))\nassert colon_tuplex((\"HELLO\", 5, [], True) ,2,500)==(\"HELLO\", 5, [500], True)\n"} | |
| {"task_id": "308", "prompt": "# Write a function to find the specified number of largest products from two given lists, selecting one factor from each list.\n", "test_code": "assert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],3)==[60, 54, 50]\nassert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],4)==[60, 54, 50, 48]\nassert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],5)==[60, 54, 50, 48, 45]\n"} | |
| {"task_id": "309", "prompt": "# Write a python function to find the maximum of two numbers.\n", "test_code": "assert maximum(5,10) == 10\nassert maximum(-1,-2) == -1\nassert maximum(9,7) == 9\n"} | |
| {"task_id": "310", "prompt": "# Write a function to convert a given string to a tuple of characters.\n", "test_code": "assert string_to_tuple(\"python 3.0\")==('p', 'y', 't', 'h', 'o', 'n', '3', '.', '0')\nassert string_to_tuple(\"item1\")==('i', 't', 'e', 'm', '1')\nassert string_to_tuple(\"15.10\")==('1', '5', '.', '1', '0')\n"} | |
| {"task_id": "311", "prompt": "# Write a python function to set the left most unset bit.\n", "test_code": "assert set_left_most_unset_bit(10) == 14\nassert set_left_most_unset_bit(12) == 14\nassert set_left_most_unset_bit(15) == 15\n"} | |
| {"task_id": "312", "prompt": "# Write a function to find the volume of a cone.\n", "test_code": "assert math.isclose(volume_cone(5,12), 314.15926535897927, rel_tol=0.001)\nassert math.isclose(volume_cone(10,15), 1570.7963267948965, rel_tol=0.001)\nassert math.isclose(volume_cone(19,17), 6426.651371693521, rel_tol=0.001)\n"} | |
| {"task_id": "388", "prompt": "# Write a python function to find the highest power of 2 that is less than or equal to n.\n", "test_code": "assert highest_Power_of_2(10) == 8\nassert highest_Power_of_2(19) == 16\nassert highest_Power_of_2(32) == 32\n"} | |
| {"task_id": "389", "prompt": "# Write a function to find the n'th lucas number.\n", "test_code": "assert find_lucas(9) == 76\nassert find_lucas(4) == 7\nassert find_lucas(3) == 4\n"} | |
| {"task_id": "390", "prompt": "# Write a function to apply a given format string to all of the elements in a list.\n", "test_code": "assert add_string([1,2,3,4],'temp{0}')==['temp1', 'temp2', 'temp3', 'temp4']\nassert add_string(['a','b','c','d'], 'python{0}')==[ 'pythona', 'pythonb', 'pythonc', 'pythond']\nassert add_string([5,6,7,8],'string{0}')==['string5', 'string6', 'string7', 'string8']\n"} | |
| {"task_id": "391", "prompt": "# Write a function to convert more than one list to nested dictionary.\n", "test_code": "assert convert_list_dictionary([\"S001\", \"S002\", \"S003\", \"S004\"],[\"Adina Park\", \"Leyton Marsh\", \"Duncan Boyle\", \"Saim Richards\"] ,[85, 98, 89, 92])==[{'S001': {'Adina Park': 85}}, {'S002': {'Leyton Marsh': 98}}, {'S003': {'Duncan Boyle': 89}}, {'S004': {'Saim Richards': 92}}]\nassert convert_list_dictionary([\"abc\",\"def\",\"ghi\",\"jkl\"],[\"python\",\"program\",\"language\",\"programs\"],[100,200,300,400])==[{'abc':{'python':100}},{'def':{'program':200}},{'ghi':{'language':300}},{'jkl':{'programs':400}}]\nassert convert_list_dictionary([\"A1\",\"A2\",\"A3\",\"A4\"],[\"java\",\"C\",\"C++\",\"DBMS\"],[10,20,30,40])==[{'A1':{'java':10}},{'A2':{'C':20}},{'A3':{'C++':30}},{'A4':{'DBMS':40}}]\n"} | |
| {"task_id": "392", "prompt": "# Write a function to find the maximum sum possible by using the given equation f(n) = max( (f(n/2) + f(n/3) + f(n/4) + f(n/5)), n).\n", "test_code": "assert get_max_sum(60) == 106\nassert get_max_sum(10) == 12\nassert get_max_sum(2) == 2\n"} | |
| {"task_id": "393", "prompt": "# Write a function to find the list with maximum length.\n", "test_code": "assert max_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(3, [13, 15, 17])\nassert max_length_list([[1,2,3,4,5],[1,2,3,4],[1,2,3],[1,2],[1]])==(5,[1,2,3,4,5])\nassert max_length_list([[3,4,5],[6,7,8,9],[10,11,12]])==(4,[6,7,8,9])\n"} | |
| {"task_id": "394", "prompt": "# Write a function to check if given tuple contains no duplicates.\n", "test_code": "assert check_distinct((1, 4, 5, 6, 1, 4)) == False\nassert check_distinct((1, 4, 5, 6)) == True\nassert check_distinct((2, 3, 4, 5, 6)) == True\n"} | |
| {"task_id": "395", "prompt": "# Write a python function to find the first non-repeated character in a given string.\n", "test_code": "assert first_non_repeating_character(\"abcabc\") == None\nassert first_non_repeating_character(\"abc\") == \"a\"\nassert first_non_repeating_character(\"ababc\") == \"c\"\n"} | |
| {"task_id": "396", "prompt": "# Write a function to check whether the given string starts and ends with the same character or not.\n", "test_code": "assert check_char(\"abba\") == \"Valid\"\nassert check_char(\"a\") == \"Valid\"\nassert check_char(\"abcd\") == \"Invalid\"\n"} | |
| {"task_id": "397", "prompt": "# Write a function to find the median of three numbers.\n", "test_code": "assert median_numbers(25,55,65)==55.0\nassert median_numbers(20,10,30)==20.0\nassert median_numbers(15,45,75)==45.0\n"} | |
| {"task_id": "398", "prompt": "# Write a function to compute the sum of digits of each number of a given list.\n", "test_code": "assert sum_of_digits([10,2,56])==14\nassert sum_of_digits([[10,20,4,5,'b',70,'a']])==19\nassert sum_of_digits([10,20,-4,5,-70])==19\n"} | |
| {"task_id": "399", "prompt": "# Write a function to perform the mathematical bitwise xor operation across the given tuples.\n", "test_code": "assert bitwise_xor((10, 4, 6, 9), (5, 2, 3, 3)) == (15, 6, 5, 10)\nassert bitwise_xor((11, 5, 7, 10), (6, 3, 4, 4)) == (13, 6, 3, 14)\nassert bitwise_xor((12, 6, 8, 11), (7, 4, 5, 6)) == (11, 2, 13, 13)\n"} | |
| {"task_id": "400", "prompt": "# Write a function to extract the number of unique tuples in the given list.\n", "test_code": "assert extract_freq([(3, 4), (1, 2), (4, 3), (5, 6)] ) == 3\nassert extract_freq([(4, 15), (2, 3), (5, 4), (6, 7)] ) == 4\nassert extract_freq([(5, 16), (2, 3), (6, 5), (6, 9)] ) == 4\n"} | |
| {"task_id": "401", "prompt": "# Write a function to perform index wise addition of tuple elements in the given two nested tuples.\n", "test_code": "assert add_nested_tuples(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((7, 10), (7, 14), (3, 10), (8, 13))\nassert add_nested_tuples(((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))) == ((9, 12), (9, 16), (5, 12), (10, 15))\nassert add_nested_tuples(((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))) == ((11, 14), (11, 18), (7, 14), (12, 17))\n"} | |
| {"task_id": "404", "prompt": "# Write a python function to find the minimum of two numbers.\n", "test_code": "assert minimum(1,2) == 1\nassert minimum(-5,-4) == -5\nassert minimum(0,0) == 0\n"} | |
| {"task_id": "405", "prompt": "# Write a function to check whether an element exists within a tuple.\n", "test_code": "assert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'r')==True\nassert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'5')==False\nassert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\",\"e\"),3)==True\n"} | |
| {"task_id": "406", "prompt": "# Write a python function to find whether the parity of a given number is odd.\n", "test_code": "assert find_Parity(12) == False\nassert find_Parity(7) == True\nassert find_Parity(10) == False\n"} | |
| {"task_id": "407", "prompt": "# Write a function to create the next bigger number by rearranging the digits of a given number.\n", "test_code": "assert rearrange_bigger(12)==21\nassert rearrange_bigger(10)==False\nassert rearrange_bigger(102)==120\n"} | |
| {"task_id": "408", "prompt": "# Write a function to find k number of smallest pairs which consist of one element from the first array and one element from the second array.\n", "test_code": "assert k_smallest_pairs([1,3,7],[2,4,6],2)==[[1, 2], [1, 4]]\nassert k_smallest_pairs([1,3,7],[2,4,6],1)==[[1, 2]]\nassert k_smallest_pairs([1,3,7],[2,4,6],7)==[[1, 2], [1, 4], [3, 2], [1, 6], [3, 4], [3, 6], [7, 2]]\n"} | |
| {"task_id": "409", "prompt": "# Write a function to find the minimum product from the pairs of tuples within a given list.\n", "test_code": "assert min_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==8\nassert min_product_tuple([(10,20), (15,2), (5,10)] )==30\nassert min_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==100\n"} | |
| {"task_id": "410", "prompt": "# Write a function to find the minimum value in a given heterogeneous list.\n", "test_code": "assert min_val(['Python', 3, 2, 4, 5, 'version'])==2\nassert min_val(['Python', 15, 20, 25])==15\nassert min_val(['Python', 30, 20, 40, 50, 'version'])==20\n"} | |
| {"task_id": "411", "prompt": "# Write a function to convert the given snake case string to camel case string.\n", "test_code": "assert snake_to_camel('android_tv') == 'AndroidTv'\nassert snake_to_camel('google_pixel') == 'GooglePixel'\nassert snake_to_camel('apple_watch') == 'AppleWatch'\n"} | |
| {"task_id": "412", "prompt": "# Write a python function to remove odd numbers from a given list.\n", "test_code": "assert remove_odd([1,2,3]) == [2]\nassert remove_odd([2,4,6]) == [2,4,6]\nassert remove_odd([10,20,3]) == [10,20]\n"} | |
| {"task_id": "413", "prompt": "# Write a function to extract the nth element from a given list of tuples.\n", "test_code": "assert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,0)==['Greyson Fulton', 'Brady Kent', 'Wyatt Knott', 'Beau Turnbull']\nassert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,2)==[99, 96, 94, 98]\nassert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)],1)==[98, 97, 91, 94]\n"} | |
| {"task_id": "414", "prompt": "# Write a python function to check whether any value in a sequence exists in a sequence or not.\n", "test_code": "assert overlapping([1,2,3,4,5],[6,7,8,9]) == False\nassert overlapping([1,2,3],[4,5,6]) == False\nassert overlapping([1,4,5],[1,4,5]) == True\n"} | |
| {"task_id": "415", "prompt": "# Write a python function to find a pair with highest product from a given array of integers.\n", "test_code": "assert max_Product([1,2,3,4,7,0,8,4]) == (7,8)\nassert max_Product([0,-1,-2,-4,5,0,-6]) == (-4,-6)\nassert max_Product([1,2,3]) == (2,3)\n"} | |
| {"task_id": "417", "prompt": "# Write a function to find common first element in given list of tuple.\n", "test_code": "assert group_tuples([('x', 'y'), ('x', 'z'), ('w', 't')]) == [('x', 'y', 'z'), ('w', 't')]\nassert group_tuples([('a', 'b'), ('a', 'c'), ('d', 'e')]) == [('a', 'b', 'c'), ('d', 'e')]\nassert group_tuples([('f', 'g'), ('f', 'g'), ('h', 'i')]) == [('f', 'g', 'g'), ('h', 'i')]\n"} | |
| {"task_id": "418", "prompt": "# Write a python function to find the element of a list having maximum length.\n", "test_code": "assert Find_Max([['A'],['A','B'],['A','B','C']]) == ['A','B','C']\nassert Find_Max([[1],[1,2],[1,2,3]]) == [1,2,3]\nassert Find_Max([[1,1],[1,2,3],[1,5,6,1]]) == [1,5,6,1]\n"} | |
| {"task_id": "419", "prompt": "# Write a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list.\n", "test_code": "assert round_and_sum([22.4, 4.0, -16.22, -9.10, 11.00, -12.22, 14.20, -5.20, 17.50])==243\nassert round_and_sum([5,2,9,24.3,29])==345\nassert round_and_sum([25.0,56.7,89.2])==513\n"} | |
| {"task_id": "420", "prompt": "# Write a python function to find the cube sum of first n even natural numbers.\n", "test_code": "assert cube_Sum(2) == 72\nassert cube_Sum(3) == 288\nassert cube_Sum(4) == 800\n"} | |
| {"task_id": "421", "prompt": "# Write a function to concatenate each element of tuple by the delimiter.\n", "test_code": "assert concatenate_tuple((\"ID\", \"is\", 4, \"UTS\") ) == 'ID-is-4-UTS'\nassert concatenate_tuple((\"QWE\", \"is\", 4, \"RTY\") ) == 'QWE-is-4-RTY'\nassert concatenate_tuple((\"ZEN\", \"is\", 4, \"OP\") ) == 'ZEN-is-4-OP'\n"} | |
| {"task_id": "422", "prompt": "# Write a python function to find the average of cubes of first n natural numbers.\n", "test_code": "assert find_Average_Of_Cube(2) == 4.5\nassert find_Average_Of_Cube(3) == 12\nassert find_Average_Of_Cube(1) == 1\n"} | |
| {"task_id": "424", "prompt": "# Write a function to extract only the rear index element of each string in the given tuple.\n", "test_code": "assert extract_rear(('Mers', 'for', 'Vers') ) == ['s', 'r', 's']\nassert extract_rear(('Avenge', 'for', 'People') ) == ['e', 'r', 'e']\nassert extract_rear(('Gotta', 'get', 'go') ) == ['a', 't', 'o']\n"} | |
| {"task_id": "425", "prompt": "# Write a function to count the number of sublists containing a particular element.\n", "test_code": "assert count_element_in_list([[1, 3], [5, 7], [1, 11], [1, 15, 7]],1)==3\nassert count_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'A')==3\nassert count_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'E')==1\n"} | |
| {"task_id": "426", "prompt": "# Write a function to filter odd numbers.\n", "test_code": "assert filter_oddnumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1,3,5,7,9]\nassert filter_oddnumbers([10,20,45,67,84,93])==[45,67,93]\nassert filter_oddnumbers([5,7,9,8,6,4,3])==[5,7,9,3]\n"} | |
| {"task_id": "427", "prompt": "# Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format.\n", "test_code": "assert change_date_format(\"2026-01-02\") == '02-01-2026'\nassert change_date_format(\"2020-11-13\") == '13-11-2020'\nassert change_date_format(\"2021-04-26\") == '26-04-2021'\n"} | |
| {"task_id": "428", "prompt": "# Write a function to sort the given array by using shell sort.\n", "test_code": "assert shell_sort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) == [2, 3, 4, 5, 12, 12, 23, 56, 81, 95]\nassert shell_sort([24, 22, 39, 34, 87, 73, 68]) == [22, 24, 34, 39, 68, 73, 87]\nassert shell_sort([32, 30, 16, 96, 82, 83, 74]) == [16, 30, 32, 74, 82, 83, 96]\n"} | |
| {"task_id": "429", "prompt": "# Write a function to extract the elementwise and tuples from the given two tuples.\n", "test_code": "assert and_tuples((10, 4, 6, 9), (5, 2, 3, 3)) == (0, 0, 2, 1)\nassert and_tuples((1, 2, 3, 4), (5, 6, 7, 8)) == (1, 2, 3, 0)\nassert and_tuples((8, 9, 11, 12), (7, 13, 14, 17)) == (0, 9, 10, 0)\n"} | |
| {"task_id": "430", "prompt": "# Write a function to find the directrix of a parabola.\n", "test_code": "assert parabola_directrix(5,3,2)==-198\nassert parabola_directrix(9,8,4)==-2336\nassert parabola_directrix(2,4,6)==-130\n"} | |
| {"task_id": "431", "prompt": "# Write a function that takes two lists and returns true if they have at least one common element.\n", "test_code": "assert common_element([1,2,3,4,5], [5,6,7,8,9])==True\nassert common_element([1,2,3,4,5], [6,7,8,9])==None\nassert common_element(['a','b','c'], ['d','b','e'])==True\n"} | |
| {"task_id": "432", "prompt": "# Write a function to find the median length of a trapezium.\n", "test_code": "assert median_trapezium(15,25,35)==20\nassert median_trapezium(10,20,30)==15\nassert median_trapezium(6,9,4)==7.5\n"} | |
| {"task_id": "433", "prompt": "# Write a function to check whether the entered number is greater than the elements of the given array.\n", "test_code": "assert check_greater([1, 2, 3, 4, 5], 4) == False\nassert check_greater([2, 3, 4, 5, 6], 8) == True\nassert check_greater([9, 7, 4, 8, 6, 1], 11) == True\n"} | |
| {"task_id": "434", "prompt": "# Write a function that matches a string that has an a followed by one or more b's.\n", "test_code": "assert text_match_one(\"ac\")==False\nassert text_match_one(\"dc\")==False\nassert text_match_one(\"abba\")==True\n"} | |
| {"task_id": "435", "prompt": "# Write a python function to find the last digit of a given number.\n", "test_code": "assert last_Digit(123) == 3\nassert last_Digit(25) == 5\nassert last_Digit(30) == 0\n"} | |
| {"task_id": "436", "prompt": "# Write a python function to return the negative numbers in a list.\n", "test_code": "assert neg_nos([-1,4,5,-6]) == [-1,-6]\nassert neg_nos([-1,-2,3,4]) == [-1,-2]\nassert neg_nos([-7,-6,8,9]) == [-7,-6]\n"} | |
| {"task_id": "437", "prompt": "# Write a function to remove odd characters in a string.\n", "test_code": "assert remove_odd(\"python\")==(\"yhn\")\nassert remove_odd(\"program\")==(\"rga\")\nassert remove_odd(\"language\")==(\"agae\")\n"} | |
| {"task_id": "438", "prompt": "# Write a function to count bidirectional tuple pairs.\n", "test_code": "assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 3\nassert count_bidirectional([(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 2\nassert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 2), (6, 5), (2, 1)] ) == 4\n"} | |
| {"task_id": "439", "prompt": "# Write a function to join a list of multiple integers into a single integer.\n", "test_code": "assert multiple_to_single([11, 33, 50])==113350\nassert multiple_to_single([-1,2,3,4,5,6])==-123456\nassert multiple_to_single([10,15,20,25])==10152025\n"} | |
| {"task_id": "440", "prompt": "# Write a function to find the first adverb and their positions in a given sentence.\n", "test_code": "assert find_adverb_position(\"clearly!! we can see the sky\")==(0, 7, 'clearly')\nassert find_adverb_position(\"seriously!! there are many roses\")==(0, 9, 'seriously')\nassert find_adverb_position(\"unfortunately!! sita is going to home\")==(0, 13, 'unfortunately')\n"} | |
| {"task_id": "441", "prompt": "# Write a function to find the surface area of a cube of a given size.\n", "test_code": "assert surfacearea_cube(5)==150\nassert surfacearea_cube(3)==54\nassert surfacearea_cube(10)==600\n"} | |
| {"task_id": "442", "prompt": "# Write a function to find the ration of positive numbers in an array of integers.\n", "test_code": "assert positive_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8])==0.54\nassert positive_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==0.69\nassert positive_count([2, 4, -6, -9, 11, -12, 14, -5, 17])==0.56\n"} | |
| {"task_id": "443", "prompt": "# Write a python function to find the largest negative number from the given list.\n", "test_code": "assert largest_neg([1,2,3,-4,-6]) == -6\nassert largest_neg([1,2,3,-8,-9]) == -9\nassert largest_neg([1,2,3,4,-1]) == -1\n"} | |
| {"task_id": "444", "prompt": "# Write a function to trim each tuple by k in the given tuple list.\n", "test_code": "assert trim_tuple([(5, 3, 2, 1, 4), (3, 4, 9, 2, 1),(9, 1, 2, 3, 5), (4, 8, 2, 1, 7)], 2) == '[(2,), (9,), (2,), (2,)]'\nassert trim_tuple([(5, 3, 2, 1, 4), (3, 4, 9, 2, 1), (9, 1, 2, 3, 5), (4, 8, 2, 1, 7)], 1) == '[(3, 2, 1), (4, 9, 2), (1, 2, 3), (8, 2, 1)]'\nassert trim_tuple([(7, 8, 4, 9), (11, 8, 12, 4),(4, 1, 7, 8), (3, 6, 9, 7)], 1) == '[(8, 4), (8, 12), (1, 7), (6, 9)]'\n"} | |
| {"task_id": "445", "prompt": "# Write a function to perform index wise multiplication of tuple elements in the given two tuples.\n", "test_code": "assert index_multiplication(((1, 3), (4, 5), (2, 9), (1, 10)),((6, 7), (3, 9), (1, 1), (7, 3)) ) == ((6, 21), (12, 45), (2, 9), (7, 30))\nassert index_multiplication(((2, 4), (5, 6), (3, 10), (2, 11)),((7, 8), (4, 10), (2, 2), (8, 4)) ) == ((14, 32), (20, 60), (6, 20), (16, 44))\nassert index_multiplication(((3, 5), (6, 7), (4, 11), (3, 12)),((8, 9), (5, 11), (3, 3), (9, 5)) ) == ((24, 45), (30, 77), (12, 33), (27, 60))\n"} | |
| {"task_id": "446", "prompt": "# Write a python function to count the occurence of all elements of list in a tuple.\n", "test_code": "assert count_Occurrence(('a', 'a', 'c', 'b', 'd'),['a', 'b'] ) == 3\nassert count_Occurrence((1, 2, 3, 1, 4, 6, 7, 1, 4),[1, 4, 7]) == 6\nassert count_Occurrence((1,2,3,4,5,6),[1,2]) == 2\n"} | |
| {"task_id": "447", "prompt": "# Write a function to find cubes of individual elements in a list.\n", "test_code": "assert cube_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]\nassert cube_nums([10,20,30])==([1000, 8000, 27000])\nassert cube_nums([12,15])==([1728, 3375])\n"} | |
| {"task_id": "448", "prompt": "# Write a function to calculate the sum of perrin numbers.\n", "test_code": "assert cal_sum(9) == 49\nassert cal_sum(10) == 66\nassert cal_sum(11) == 88\n"} | |
| {"task_id": "450", "prompt": "# Write a function to extract specified size of strings from a given list of string values.\n", "test_code": "assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,8)==['practice', 'solution']\nassert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,6)==['Python']\nassert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,9)==['exercises']\n"} | |
| {"task_id": "451", "prompt": "# Write a function to remove all whitespaces from the given string.\n", "test_code": "assert remove_whitespaces(' Google Flutter ') == 'GoogleFlutter'\nassert remove_whitespaces(' Google Dart ') == 'GoogleDart'\nassert remove_whitespaces(' iOS Swift ') == 'iOSSwift'\n"} | |
| {"task_id": "452", "prompt": "# Write a function that gives loss amount on a sale if the given amount has loss else return 0.\n", "test_code": "assert loss_amount(1500,1200)==0\nassert loss_amount(100,200)==100\nassert loss_amount(2000,5000)==3000\n"} | |
| {"task_id": "453", "prompt": "# Write a python function to find the sum of even factors of a number.\n", "test_code": "assert sumofFactors(18) == 26\nassert sumofFactors(30) == 48\nassert sumofFactors(6) == 8\n"} | |
| {"task_id": "454", "prompt": "# Write a function that matches a word containing 'z'.\n", "test_code": "assert text_match_wordz(\"pythonz.\")==True\nassert text_match_wordz(\"xyz.\")==True\nassert text_match_wordz(\" lang .\")==False\n"} | |
| {"task_id": "455", "prompt": "# Write a function to check whether the given month number contains 31 days or not.\n", "test_code": "assert check_monthnumb_number(5)==True\nassert check_monthnumb_number(2)==False\nassert check_monthnumb_number(6)==False\n"} | |
| {"task_id": "456", "prompt": "# Write a function to reverse each string in a given list of string values.\n", "test_code": "assert reverse_string_list(['Red', 'Green', 'Blue', 'White', 'Black'])==['deR', 'neerG', 'eulB', 'etihW', 'kcalB']\nassert reverse_string_list(['john','amal','joel','george'])==['nhoj','lama','leoj','egroeg']\nassert reverse_string_list(['jack','john','mary'])==['kcaj','nhoj','yram']\n"} | |
| {"task_id": "457", "prompt": "# Write a python function to find the sublist having minimum length.\n", "test_code": "assert Find_Min([[1],[1,2],[1,2,3]]) == [1]\nassert Find_Min([[1,1],[1,1,1],[1,2,7,8]]) == [1,1]\nassert Find_Min([['x'],['x','y'],['x','y','z']]) == ['x']\n"} | |
| {"task_id": "458", "prompt": "# Write a function to find the area of a rectangle.\n", "test_code": "assert rectangle_area(10,20)==200\nassert rectangle_area(10,5)==50\nassert rectangle_area(4,2)==8\n"} | |
| {"task_id": "459", "prompt": "# Write a function to remove uppercase substrings from a given string.\n", "test_code": "assert remove_uppercase('cAstyoUrFavoRitETVshoWs') == 'cstyoravoitshos'\nassert remove_uppercase('wAtchTheinTernEtrAdIo') == 'wtchheinerntrdo'\nassert remove_uppercase('VoicESeaRchAndreComMendaTionS') == 'oiceachndreomendaion'\n"} | |
| {"task_id": "460", "prompt": "# Write a python function to get the first element of each sublist.\n", "test_code": "assert Extract([[1, 2], [3, 4, 5], [6, 7, 8, 9]]) == [1, 3, 6]\nassert Extract([[1,2,3],[4, 5]]) == [1,4]\nassert Extract([[9,8,1],[1,2]]) == [9,1]\n"} | |
| {"task_id": "461", "prompt": "# Write a python function to count the upper case characters in a given string.\n", "test_code": "assert upper_ctr('PYthon') == 1\nassert upper_ctr('BigData') == 1\nassert upper_ctr('program') == 0\n"} | |
| {"task_id": "462", "prompt": "# Write a function to find all possible combinations of the elements of a given list.\n", "test_code": "assert combinations_list(['orange', 'red', 'green', 'blue'])==[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]\nassert combinations_list(['red', 'green', 'blue', 'white', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]\nassert combinations_list(['red', 'green', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]\n"} | |
| {"task_id": "463", "prompt": "# Write a function to find the maximum product subarray of the given array.\n", "test_code": "assert max_subarray_product([1, -2, -3, 0, 7, -8, -2]) == 112\nassert max_subarray_product([6, -3, -10, 0, 2]) == 180\nassert max_subarray_product([-2, -40, 0, -2, -3]) == 80\n"} | |
| {"task_id": "464", "prompt": "# Write a function to check if all values are same in a dictionary.\n", "test_code": "assert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},10)==False\nassert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},12)==True\nassert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},5)==False\n"} | |
| {"task_id": "465", "prompt": "# Write a function to drop empty items from a given dictionary.\n", "test_code": "assert drop_empty({'c1': 'Red', 'c2': 'Green', 'c3':None})=={'c1': 'Red', 'c2': 'Green'}\nassert drop_empty({'c1': 'Red', 'c2': None, 'c3':None})=={'c1': 'Red'}\nassert drop_empty({'c1': None, 'c2': 'Green', 'c3':None})=={ 'c2': 'Green'}\n"} | |
| {"task_id": "468", "prompt": "# Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.\n", "test_code": "assert max_product([3, 100, 4, 5, 150, 6]) == 3000\nassert max_product([4, 42, 55, 68, 80]) == 50265600\nassert max_product([10, 22, 9, 33, 21, 50, 41, 60]) == 2460\n"} | |
| {"task_id": "470", "prompt": "# Write a function to find the pairwise addition of the neighboring elements of the given tuple.\n", "test_code": "assert add_pairwise((1, 5, 7, 8, 10)) == (6, 12, 15, 18)\nassert add_pairwise((2, 6, 8, 9, 11)) == (8, 14, 17, 20)\nassert add_pairwise((3, 7, 9, 10, 12)) == (10, 16, 19, 22)\n"} | |
| {"task_id": "471", "prompt": "# Write a python function to find the product of the array multiplication modulo n.\n", "test_code": "assert find_remainder([ 100, 10, 5, 25, 35, 14 ],11) ==9\nassert find_remainder([1,1,1],1) == 0\nassert find_remainder([1,2,1],2) == 0\n"} | |
| {"task_id": "472", "prompt": "# Write a python function to check whether the given list contains consecutive numbers or not.\n", "test_code": "assert check_Consecutive([1,2,3,4,5]) == True\nassert check_Consecutive([1,2,3,5,6]) == False\nassert check_Consecutive([1,2,1]) == False\n"} | |
| {"task_id": "473", "prompt": "# Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order.\n", "test_code": "assert tuple_intersection([(3, 4), (5, 6), (9, 10), (4, 5)] , [(5, 4), (3, 4), (6, 5), (9, 11)]) == {(4, 5), (3, 4), (5, 6)}\nassert tuple_intersection([(4, 1), (7, 4), (11, 13), (17, 14)] , [(1, 4), (7, 4), (16, 12), (10, 13)]) == {(4, 7), (1, 4)}\nassert tuple_intersection([(2, 1), (3, 2), (1, 3), (1, 4)] , [(11, 2), (2, 3), (6, 2), (1, 3)]) == {(1, 3), (2, 3)}\n"} | |
| {"task_id": "474", "prompt": "# Write a function to replace characters in a string.\n", "test_code": "assert replace_char(\"polygon\",'y','l')==(\"pollgon\")\nassert replace_char(\"character\",'c','a')==(\"aharaater\")\nassert replace_char(\"python\",'l','a')==(\"python\")\n"} | |
| {"task_id": "475", "prompt": "# Write a function to sort a dictionary by value.\n", "test_code": "assert sort_counter({'Math':81, 'Physics':83, 'Chemistry':87})==[('Chemistry', 87), ('Physics', 83), ('Math', 81)]\nassert sort_counter({'Math':400, 'Physics':300, 'Chemistry':250})==[('Math', 400), ('Physics', 300), ('Chemistry', 250)]\nassert sort_counter({'Math':900, 'Physics':1000, 'Chemistry':1250})==[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)]\n"} | |
| {"task_id": "476", "prompt": "# Write a python function to find the sum of the largest and smallest value in a given array.\n", "test_code": "assert big_sum([1,2,3]) == 4\nassert big_sum([-1,2,3,4]) == 3\nassert big_sum([2,3,6]) == 8\n"} | |
| {"task_id": "477", "prompt": "# Write a python function to convert the given string to lower case.\n", "test_code": "assert is_lower(\"InValid\") == \"invalid\"\nassert is_lower(\"TruE\") == \"true\"\nassert is_lower(\"SenTenCE\") == \"sentence\"\n"} | |
| {"task_id": "478", "prompt": "# Write a function to remove lowercase substrings from a given string.\n", "test_code": "assert remove_lowercase(\"PYTHon\")==('PYTH')\nassert remove_lowercase(\"FInD\")==('FID')\nassert remove_lowercase(\"STRinG\")==('STRG')\n"} | |
| {"task_id": "479", "prompt": "# Write a python function to find the first digit of a given number.\n", "test_code": "assert first_Digit(123) == 1\nassert first_Digit(456) == 4\nassert first_Digit(12) == 1\n"} | |