prompt
stringlengths
42
252
test_imports
sequencelengths
0
1
test_list
sequencelengths
3
5
Write a python function to remove first and last occurrence of a given character from the string.
[]
[ "assert remove_Occ(\"hello\",\"l\") == \"heo\"", "assert remove_Occ(\"abcda\",\"a\") == \"bcd\"", "assert remove_Occ(\"PHP\",\"P\") == \"H\"" ]
Write a function to sort a given matrix in ascending order according to the sum of its rows.
[]
[ "assert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]", "assert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]", "assert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]" ]
Write a python function to find the volume of a triangular prism.
[]
[ "assert find_Volume(10,8,6) == 240", "assert find_Volume(3,2,2) == 6", "assert find_Volume(1,2,1) == 1" ]
Write a function to that returns true if the input string contains sequences of lowercase letters joined with an underscore and false otherwise.
[]
[ "assert text_lowercase_underscore(\"aab_cbbbc\")==(True)", "assert text_lowercase_underscore(\"aab_Abbbc\")==(False)", "assert text_lowercase_underscore(\"Aaab_abbbc\")==(False)" ]
Write a function that returns the perimeter of a square given its side length as input.
[]
[ "assert square_perimeter(10)==40", "assert square_perimeter(5)==20", "assert square_perimeter(4)==16" ]
Write a function to remove characters from the first string which are present in the second string.
[]
[ "assert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'", "assert remove_dirty_chars(\"digitalindia\", \"talent\") == 'digiidi'", "assert remove_dirty_chars(\"exoticmiles\", \"toxic\") == 'emles'" ]
Write a function to find whether a given array of integers contains any duplicate element.
[]
[ "assert test_duplicate(([1,2,3,4,5]))==False", "assert test_duplicate(([1,2,3,4, 4]))==True", "assert test_duplicate([1,1,2,2,3,3,4,4,5])==True" ]
Write a function to check if the given number is woodball or not.
[]
[ "assert is_woodall(383) == True", "assert is_woodall(254) == False", "assert is_woodall(200) == False" ]
Write a python function to check if a given number is one less than twice its reverse.
[]
[ "assert check(70) == False", "assert check(23) == False", "assert check(73) == True" ]
Write a python function to find the largest number that can be formed with the given list of digits.
[]
[ "assert find_Max_Num([1,2,3]) == 321", "assert find_Max_Num([4,5,6,1]) == 6541", "assert find_Max_Num([1,2,3,9]) == 9321" ]
Write a python function to check whether the given two integers have opposite sign or not.
[]
[ "assert opposite_Signs(1,-2) == True", "assert opposite_Signs(3,2) == False", "assert opposite_Signs(-10,-10) == False", "assert opposite_Signs(-2,2) == True" ]
Write a function to find the nth octagonal number.
[]
[ "assert is_octagonal(5) == 65", "assert is_octagonal(10) == 280", "assert is_octagonal(15) == 645" ]
Write a python function to count the number of substrings with the sum of digits equal to their length.
[]
[ "assert count_Substrings('112112') == 6", "assert count_Substrings('111') == 6", "assert count_Substrings('1101112') == 12" ]
Write a python function to find smallest number in a list.
[]
[ "assert smallest_num([10, 20, 1, 45, 99]) == 1", "assert smallest_num([1, 2, 3]) == 1", "assert smallest_num([45, 46, 50, 60]) == 45" ]
Write a function to find the maximum difference between available pairs in the given tuple list.
[]
[ "assert max_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7", "assert max_difference([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15", "assert max_difference([(12, 35), (21, 27), (13, 23), (41, 22)]) == 23" ]
Write a function to sort a list of tuples using the second value of each tuple.
[]
[ "assert subject_marks([('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)])==[('Social sciences', 82), ('English', 88), ('Science', 90), ('Maths', 97)]", "assert subject_marks([('Telugu',49),('Hindhi',54),('Social',33)])==([('Social',33),('Telugu',49),('Hindhi',54)])", "assert subject_marks([('Physics',96),('Chemistry',97),('Biology',45)])==([('Biology',45),('Physics',96),('Chemistry',97)])" ]
Write a function to flatten a list and sum all of its elements.
[]
[ "assert recursive_list_sum(([1, 2, [3,4],[5,6]]))==21", "assert recursive_list_sum(([7, 10, [15,14],[19,41]]))==106", "assert recursive_list_sum(([10, 20, [30,40],[50,60]]))==210" ]
Write a python function to count the number of positive numbers in a list.
[]
[ "assert pos_count([1,-2,3,-4]) == 2", "assert pos_count([3,4,5,-1]) == 3", "assert pos_count([1,2,3,4]) == 4" ]
Write a function to find the number of ways to partition a set of Bell numbers.
[]
[ "assert bell_number(2)==2", "assert bell_number(10)==115975", "assert bell_number(56)==6775685320645824322581483068371419745979053216268760300" ]
Write a python function to check whether the given array is monotonic or not.
[]
[ "assert is_Monotonic([6, 5, 4, 4]) == True", "assert is_Monotonic([1, 2, 2, 3]) == True", "assert is_Monotonic([1, 3, 2]) == False" ]
Write a function to check whether a list contains the given sublist or not.
[]
[ "assert is_sublist([2,4,3,5,7],[3,7])==False", "assert is_sublist([2,4,3,5,7],[4,3])==True", "assert is_sublist([2,4,3,5,7],[1,6])==False" ]
Write a function to find whether all the given tuples have equal length or not.
[]
[ "assert get_equal([(11, 22, 33), (44, 55, 66)]) == True", "assert get_equal([(1, 2, 3), (4, 5, 6, 7)]) == False", "assert get_equal([(1, 2), (3, 4)]) == True" ]
Write a function to sort a list of elements.
[]
[ "assert comb_sort([5, 15, 37, 25, 79]) == [5, 15, 25, 37, 79]", "assert comb_sort([41, 32, 15, 19, 22]) == [15, 19, 22, 32, 41]", "assert comb_sort([99, 15, 13, 47]) == [13, 15, 47, 99]" ]
Write a python function to check whether the given number can be represented as the difference of two squares or not.
[]
[ "assert dif_Square(5) == True", "assert dif_Square(10) == False", "assert dif_Square(15) == True" ]
Write a function to check whether it follows the sequence given in the patterns array.
[]
[ "assert is_samepatterns([\"red\",\"green\",\"green\"], [\"a\", \"b\", \"b\"])==True", "assert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\",\"b\"])==False", "assert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\"])==False" ]
Write a function to find tuples which have all elements divisible by k from the given list of tuples.
[]
[ "assert find_tuples([(6, 24, 12), (7, 9, 6), (12, 18, 21)], 6) == [(6, 24, 12)]", "assert find_tuples([(5, 25, 30), (4, 2, 3), (7, 8, 9)], 5) == [(5, 25, 30)]", "assert find_tuples([(7, 9, 16), (8, 16, 4), (19, 17, 18)], 4) == [(8, 16, 4)]" ]
Write a python function to find whether a number is divisible by 11.
[]
[ "assert is_Diff (12345) == False", "assert is_Diff(1212112) == True", "assert is_Diff(1212) == False" ]
Write a python function to check whether the length of the word is odd or not.
[]
[ "assert word_len(\"Hadoop\") == False", "assert word_len(\"great\") == True", "assert word_len(\"structure\") == True" ]
Write a function to find the nth tetrahedral number.
[]
[ "assert tetrahedral_number(5) == 35", "assert tetrahedral_number(6) == 56", "assert tetrahedral_number(7) == 84" ]
Write a function to find the volume of a sphere.
[ "import math" ]
[ "assert math.isclose(volume_sphere(10), 4188.790204786391, rel_tol=0.001)", "assert math.isclose(volume_sphere(25), 65449.84694978735, rel_tol=0.001)", "assert math.isclose(volume_sphere(20), 33510.32163829113, rel_tol=0.001)" ]
Write a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26.
[]
[ "assert get_Char(\"abc\") == \"f\"", "assert get_Char(\"gfg\") == \"t\"", "assert get_Char(\"ab\") == \"c\"" ]
Write a function to find the nth number in the newman conway sequence.
[]
[ "assert sequence(10) == 6", "assert sequence(2) == 1", "assert sequence(3) == 2" ]
Write a function to find the surface area of a sphere.
[ "import math" ]
[ "assert math.isclose(surfacearea_sphere(10), 1256.6370614359173, rel_tol=0.001)", "assert math.isclose(surfacearea_sphere(15), 2827.4333882308138, rel_tol=0.001)", "assert math.isclose(surfacearea_sphere(20), 5026.548245743669, rel_tol=0.001)" ]
Write a function to find nth centered hexagonal number.
[]
[ "assert centered_hexagonal_number(10) == 271", "assert centered_hexagonal_number(2) == 7", "assert centered_hexagonal_number(9) == 217" ]
Write a function to merge three dictionaries into a single dictionary.
[]
[ "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'}", "assert 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'}", "assert 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'}" ]
Write a function to get the frequency of all the elements in a list, returned as a dictionary.
[]
[ "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})", "assert freq_count([1,2,3,4,3,2,4,1,3,1,4])==({1:3, 2:2,3:3,4:3})", "assert 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})" ]
Write a function to find the closest smaller number than n.
[]
[ "assert closest_num(11) == 10", "assert closest_num(7) == 6", "assert closest_num(12) == 11" ]
Write a python function to find the length of the longest word.
[]
[ "assert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7", "assert len_log([\"a\",\"ab\",\"abc\"]) == 3", "assert len_log([\"small\",\"big\",\"tall\"]) == 5" ]
Write a function to check if a string is present as a substring in a given list of string values.
[]
[ "assert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ack\")==True", "assert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"abc\")==False", "assert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ange\")==True" ]
Write a function to check whether the given number is undulating or not.
[]
[ "assert is_undulating(1212121) == True", "assert is_undulating(1991) == False", "assert is_undulating(121) == True" ]
Write a function to calculate the value of 'a' to the power 'b'.
[]
[ "assert power(3,4) == 81", "assert power(2,3) == 8", "assert power(5,5) == 3125" ]
Given a list of tuples, write a function that returns the first value of the tuple with the smallest second value.
[]
[ "assert index_minimum([('Rash', 143), ('Manjeet', 200), ('Varsha', 100)]) == 'Varsha'", "assert index_minimum([('Yash', 185), ('Dawood', 125), ('Sanya', 175)]) == 'Dawood'", "assert index_minimum([('Sai', 345), ('Salman', 145), ('Ayesha', 96)]) == 'Ayesha'" ]
Write a python function to find the length of the smallest list in a list of lists.
[]
[ "assert Find_Min_Length([[1],[1,2]]) == 1", "assert Find_Min_Length([[1,2],[1,2,3],[1,2,3,4]]) == 2", "assert Find_Min_Length([[3,3,3],[4,4,4,4]]) == 3" ]
Write a python function to find the number of divisors of a given integer.
[]
[ "assert divisor(15) == 4", "assert divisor(12) == 6", "assert divisor(9) == 3" ]
Write a function to find frequency of each element in a flattened list of lists, returned in a dictionary.
[]
[ "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}", "assert 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}", "assert 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}" ]
Write a function to multiply all the numbers in a list and divide with the length of the list.
[ "import math" ]
[ "assert math.isclose(multiply_num((8, 2, 3, -1, 7)), -67.2, rel_tol=0.001)", "assert math.isclose(multiply_num((-10,-20,-30)), -2000.0, rel_tol=0.001)", "assert math.isclose(multiply_num((19,15,18)), 1710.0, rel_tol=0.001)" ]
Write a function to convert the given decimal number to its binary equivalent, represented as a string with no leading zeros.
[]
[ "assert decimal_to_binary(8) == '1000'", "assert decimal_to_binary(18) == '10010'", "assert decimal_to_binary(7) == '111'" ]
Write a function to find the next smallest palindrome of a specified integer, returned as an integer.
[]
[ "assert next_smallest_palindrome(99)==101", "assert next_smallest_palindrome(1221)==1331", "assert next_smallest_palindrome(120)==121" ]
Write a function to find the kth element in the given array using 1-based indexing.
[]
[ "assert kth_element([12,3,5,7,19], 2) == 3", "assert kth_element([17,24,8,23], 3) == 8", "assert kth_element([16,21,25,36,4], 4) == 36" ]
Write a function to convert a snake case string to camel case string.
[]
[ "assert snake_to_camel('python_program')=='PythonProgram'", "assert snake_to_camel('python_language')==('PythonLanguage')", "assert snake_to_camel('programming_language')==('ProgrammingLanguage')" ]
Write a function to find the Eulerian number a(n, m).
[]
[ "assert eulerian_num(3, 1) == 4", "assert eulerian_num(4, 1) == 11", "assert eulerian_num(5, 3) == 26" ]
Write a function to sort each sublist of strings in a given list of lists.
[]
[ "assert sort_sublists(([\"green\", \"orange\"], [\"black\", \"white\"], [\"white\", \"black\", \"orange\"]))==[['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]", "assert sort_sublists(([\" red \",\"green\" ],[\"blue \",\" black\"],[\" orange\",\"brown\"]))==[[' red ', 'green'], [' black', 'blue '], [' orange', 'brown']]", "assert sort_sublists(([\"zilver\",\"gold\"], [\"magnesium\",\"aluminium\"], [\"steel\", \"bronze\"]))==[['gold', 'zilver'],['aluminium', 'magnesium'], ['bronze', 'steel']]" ]
Write a python function to count true booleans in the given list.
[]
[ "assert count([True,False,True]) == 2", "assert count([False,False]) == 0", "assert count([True,True,True]) == 3" ]
Write a function to append the given list to the given tuples.
[]
[ "assert add_lists([5, 6, 7], (9, 10)) == (9, 10, 5, 6, 7)", "assert add_lists([6, 7, 8], (10, 11)) == (10, 11, 6, 7, 8)", "assert add_lists([7, 8, 9], (11, 12)) == (11, 12, 7, 8, 9)" ]
Write a function to merge three lists into a single sorted list.
[]
[ "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]", "assert 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]", "assert 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]" ]
Write a python function to find the number of numbers with an odd value when rotating a binary string the given number of times.
[]
[ "assert odd_Equivalent(\"011001\",6) == 3", "assert odd_Equivalent(\"11011\",5) == 4", "assert odd_Equivalent(\"1010\",4) == 2" ]
Write a function to find the common elements in given nested lists.
[]
[ "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])", "assert set(common_in_nested_lists([[12, 5, 23, 25, 45], [7, 11, 5, 23, 28], [1, 5, 8, 18, 23, 16]]))==set([5,23])", "assert set(common_in_nested_lists([[2, 3,4, 1], [4, 5], [6,4, 8],[4, 5], [6, 8,4]]))==set([4])" ]
Write a function to check if a string represents an integer or not.
[]
[ "assert check_integer(\"python\")==False", "assert check_integer(\"1\")==True", "assert check_integer(\"12345\")==True" ]
Write a function to check whether all dictionaries in a list are empty or not.
[]
[ "assert empty_dit([{},{},{}])==True", "assert empty_dit([{1,2},{},{}])==False", "assert empty_dit({})==True" ]
Write a function to convert a given tuple of positive integers into a single integer.
[]
[ "assert tuple_to_int((1,2,3))==123", "assert tuple_to_int((4,5,6))==456", "assert tuple_to_int((5,6,7))==567" ]
Write a function to convert all possible convertible elements in a list of lists to floats.
[]
[ "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)]", "assert 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)]", "assert 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)]" ]
Write a function to convert a string to a list of strings split on the space character.
[]
[ "assert string_to_list(\"python programming\")==['python','programming']", "assert string_to_list(\"lists tuples strings\")==['lists','tuples','strings']", "assert string_to_list(\"write a program\")==['write','a','program']" ]
Write a python function to find the element that appears only once in a sorted array.
[]
[ "assert search([1,1,2,2,3]) == 3", "assert search([1,1,3,3,4,4,5,5,7,7,8]) == 8", "assert search([1,2,2,3,3,4,4]) == 1" ]
Write a function to find the maximum absolute product between numbers in pairs of tuples within a given list.
[]
[ "assert max_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36", "assert max_product_tuple([(10,20), (15,2), (5,10)] )==200", "assert max_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==484" ]
Write a function to sum all amicable numbers from 1 to a specified number.
[]
[ "assert amicable_numbers_sum(999)==504", "assert amicable_numbers_sum(9999)==31626", "assert amicable_numbers_sum(99)==0" ]
Write a function to get the angle of a complex number.
[ "import math" ]
[ "assert math.isclose(angle_complex(0,1j), 1.5707963267948966, rel_tol=0.001)", "assert math.isclose(angle_complex(2,1j), 0.4636476090008061, rel_tol=0.001)", "assert math.isclose(angle_complex(0,2j), 1.5707963267948966, rel_tol=0.001)" ]
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.
[]
[ "assert find_length(\"11000010001\") == 6", "assert find_length(\"10111\") == 1", "assert find_length(\"11011101100101\") == 2" ]
Write a python function to find the sum of common divisors of two given numbers.
[]
[ "assert sum(10,15) == 6", "assert sum(100,150) == 93", "assert sum(4,6) == 3" ]
Write a function to multiply two integers.
[]
[ "assert multiply_int(10,20)==200", "assert multiply_int(5,10)==50", "assert multiply_int(4,8)==32" ]
Write a function to find words that are longer than n characters from a given list of words.
[]
[ "assert long_words(3,\"python is a programming language\")==['python','programming','language']", "assert long_words(2,\"writing a program\")==['writing','program']", "assert long_words(5,\"sorting list\")==['sorting']" ]
Write a function to calculate whether the matrix is a magic square.
[]
[ "assert magic_square_test([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]])==True", "assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 8]])==True", "assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 7]])==False" ]
Write a function to find the item with maximum frequency in a given list.
[]
[ "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", "assert max_occurrences([2,3,8,4,7,9,8,7,9,15,14,10,12,13,16,18])==8", "assert max_occurrences([10,20,20,30,40,90,80,50,30,20,50,10])==20" ]
Write a python function to reverse only the vowels of a given string (where y is not a vowel).
[]
[ "assert reverse_vowels(\"Python\") == \"Python\"", "assert reverse_vowels(\"USA\") == \"ASU\"", "assert reverse_vowels(\"ab\") == \"ab\"" ]
Write a function to convert a tuple to a string.
[]
[ "assert tup_string(('e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's'))==(\"exercises\")", "assert tup_string(('p','y','t','h','o','n'))==(\"python\")", "assert tup_string(('p','r','o','g','r','a','m'))==(\"program\")" ]
Write a function to calculate the sum of the negative numbers of a given list of numbers.
[]
[ "assert sum_negativenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==-32", "assert sum_negativenum([10,15,-14,13,-18,12,-20])==-52", "assert sum_negativenum([19, -65, 57, 39, 152,-639, 121, 44, 90, -190])==-894" ]
Write a function to find the nth hexagonal number.
[]
[ "assert hexagonal_num(10) == 190", "assert hexagonal_num(5) == 45", "assert hexagonal_num(7) == 91" ]
Write a function to find the ratio of zeroes to non-zeroes in an array of integers.
[ "import math" ]
[ "assert math.isclose(zero_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8]), 0.181818, rel_tol=0.001)", "assert math.isclose(zero_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8]), 0.00, rel_tol=0.001)", "assert math.isclose(zero_count([2, 4, -6, -9, 11, -12, 14, -5, 17]), 0.00, rel_tol=0.001)" ]
Write a python function to check whether the given number can be represented as sum of non-zero powers of 2 or not.
[]
[ "assert is_Sum_Of_Powers_Of_Two(10) == True", "assert is_Sum_Of_Powers_Of_Two(7) == False", "assert is_Sum_Of_Powers_Of_Two(14) == True" ]
Write a function to find the circumference of a circle.
[ "import math" ]
[ "assert math.isclose(circle_circumference(10), 62.830000000000005, rel_tol=0.001)", "assert math.isclose(circle_circumference(5), 31.415000000000003, rel_tol=0.001)", "assert math.isclose(circle_circumference(4), 25.132, rel_tol=0.001)" ]
Write a function to flatten the list of lists into a single set of numbers.
[]
[ "assert set(extract_singly([(3, 4, 5), (4, 5, 7), (1, 4)])) == set([3, 4, 5, 7, 1])", "assert set(extract_singly([(1, 2, 3), (4, 2, 3), (7, 8)])) == set([1, 2, 3, 4, 7, 8])", "assert set(extract_singly([(7, 8, 9), (10, 11, 12), (10, 11)])) == set([7, 8, 9, 10, 11, 12])" ]
Write a function to count number items that are identical in the same position of three given lists.
[]
[ "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", "assert 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", "assert 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" ]
Write a function to find number of lists present in the given tuple.
[]
[ "assert find_lists(([1, 2, 3, 4], [5, 6, 7, 8])) == 2", "assert find_lists(([1, 2], [3, 4], [5, 6])) == 3", "assert find_lists(([9, 8, 7, 6, 5, 4, 3, 2, 1])) == 1" ]
Write a python function to find the maximum difference between any two elements in a given array.
[]
[ "assert max_Abs_Diff((2,1,5,3)) == 4", "assert max_Abs_Diff((9,3,2,5,1)) == 8", "assert max_Abs_Diff((3,2,1)) == 2" ]
Write a function that returns integers x and y that satisfy ax + by = n as a tuple, or return None if no solution exists.
[]
[ "assert find_solution(2, 3, 7) == (2, 1)", "assert find_solution(4, 2, 7) == None", "assert find_solution(1, 13, 17) == (4, 1)" ]
Write a function to remove all elements from a given list present in another list.
[]
[ "assert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8]) == [1, 3, 5, 7, 9, 10]", "assert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7]) == [2, 4, 6, 8, 9, 10]", "assert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [5, 7]) == [1, 2, 3, 4, 6, 8, 9, 10]" ]
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).
[]
[ "assert sum_series(6) == 12", "assert sum_series(10) == 30", "assert sum_series(9) == 25" ]
Write a function to calculate the area of a regular polygon given the length and number of its sides.
[ "import math" ]
[ "assert math.isclose(area_polygon(4, 20), 400., rel_tol=0.001)", "assert math.isclose(area_polygon(10, 15), 1731.197, rel_tol=0.001)", "assert math.isclose(area_polygon(9, 7), 302.909, rel_tol=0.001)" ]
Write a function to determine if the sum of the divisors of two integers are the same.
[]
[ "assert are_equivalent(36, 57) == False", "assert are_equivalent(2, 4) == False", "assert are_equivalent(23, 47) == True" ]
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).
[]
[ "assert count_char_position(\"xbcefg\") == 2", "assert count_char_position(\"ABcED\") == 3", "assert count_char_position(\"AbgdeF\") == 5" ]
Write a function that counts the number of pairs of integers in a list that xor to an even number.
[]
[ "assert find_even_pair([5, 4, 7, 2, 1]) == 4", "assert find_even_pair([7, 2, 8, 1, 0, 5, 11]) == 9", "assert find_even_pair([1, 2, 3]) == 1" ]
Write a python function to find the smallest power of 2 greater than or equal to n.
[]
[ "assert next_power_of_2(0) == 1", "assert next_power_of_2(5) == 8", "assert next_power_of_2(17) == 32" ]
Write a function to count the number of occurrences of a number in a given list.
[]
[ "assert frequency([1,2,3], 4) == 0", "assert frequency([1,2,2,3,3,3,4], 3) == 3", "assert frequency([0,1,2,3,1,2], 1) == 2" ]
Write a function to find the sum of numbers in a list within a range specified by two indices.
[]
[ "assert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 8, 10) == 29", "assert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 5, 7) == 16", "assert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 7, 10) == 38" ]
Write a function to find the perimeter of a regular pentagon from the length of its sides.
[]
[ "assert perimeter_pentagon(5) == 25", "assert perimeter_pentagon(10) == 50", "assert perimeter_pentagon(15) == 75" ]
Write a function to count the number of occurence of the string 'std' in a given string.
[]
[ "assert count_occurance(\"letstdlenstdporstd\") == 3", "assert count_occurance(\"truststdsolensporsd\") == 1", "assert count_occurance(\"makestdsostdworthit\") == 2", "assert count_occurance(\"stds\") == 1", "assert count_occurance(\"\") == 0" ]
Write a function to check if all the elements in tuple have same data type or not.
[]
[ "assert check_type((5, 6, 7, 3, 5, 6) ) == True", "assert check_type((1, 2, \"4\") ) == False", "assert check_type((3, 2, 1, 4, 5) ) == True" ]
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.)
[]
[ "assert is_majority([1, 2, 3, 3, 3, 3, 10], 7, 3) == True", "assert is_majority([1, 1, 2, 4, 4, 4, 6, 6], 8, 4) == False", "assert is_majority([1, 1, 1, 2, 2], 5, 1) == True", "assert is_majority([1, 1, 2, 2], 5, 1) == False" ]
Write a python function to count the number of set bits (binary digits with value 1) in a given number.
[]
[ "assert count_Set_Bits(2) == 1", "assert count_Set_Bits(4) == 1", "assert count_Set_Bits(6) == 2" ]
Write a python function to remove the characters which have odd index values of a given string.
[]
[ "assert odd_values_string('abcdef') == 'ace'", "assert odd_values_string('python') == 'pto'", "assert odd_values_string('data') == 'dt'", "assert odd_values_string('lambs') == 'lms'" ]
Write a function to find minimum of three numbers.
[]
[ "assert min_of_three(10,20,0)==0", "assert min_of_three(19,15,18)==15", "assert min_of_three(-10,-20,-30)==-30" ]