INSTRUCTION
stringlengths
85
1.13k
RESPONSE
stringlengths
98
2.66k
SOURCE
stringclasses
2 values
Write a unit test case for a Python function with description: 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.
def check(candidate): assert split_two_parts([1,1,2,3,4,4,5,1],3)==([1, 1, 2], [3, 4, 4, 5, 1]) assert split_two_parts(['a', 'b', 'c', 'd'],2)==(['a', 'b'], ['c', 'd']) assert split_two_parts(['p', 'y', 't', 'h', 'o', 'n'],4)==(['p', 'y', 't', 'h'], ['o', 'n'])
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to calculate a dog's age in dog's years.
def check(candidate): assert dog_age(12)==61 assert dog_age(15)==73 assert dog_age(24)==109
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): 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']] assert 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]] assert list_split(['python','java','C','C++','DBMS','SQL'],2)==[['python', 'C', 'DBMS'], ['java', 'C++', 'SQL']]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the lateral surface area of a cube given its side length.
def check(candidate): assert lateralsurface_cube(5)==100 assert lateralsurface_cube(9)==324 assert lateralsurface_cube(10)==400
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function that takes in an integer n and returns the sum of the squares of the first n odd natural numbers.
def check(candidate): assert square_Sum(2) == 10 assert square_Sum(3) == 35 assert square_Sum(4) == 84
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the n'th star number.
def check(candidate): assert find_star_num(3) == 37 assert find_star_num(4) == 73 assert find_star_num(5) == 121
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the ascii value of a character.
def check(candidate): assert ascii_value('A')==65 assert ascii_value('R')==82 assert ascii_value('S')==83
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the sum of even numbers at even positions of a list.
def check(candidate): assert sum_even_and_even_index([5, 6, 12, 1, 18, 8]) == 30 assert sum_even_and_even_index([3, 20, 17, 9, 2, 10, 18, 13, 6, 18]) == 26 assert sum_even_and_even_index([5, 6, 12, 1]) == 12
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert even_Power_Sum(2) == 1056 assert even_Power_Sum(3) == 8832 assert even_Power_Sum(1) == 32
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function that takes in a list of tuples and returns a list containing the rear element of each tuple.
def check(candidate): assert rear_extract([(1, 'Rash', 21), (2, 'Varsha', 20), (3, 'Kil', 19)]) == [21, 20, 19] assert rear_extract([(1, 'Sai', 36), (2, 'Ayesha', 25), (3, 'Salman', 45)]) == [36, 25, 45] assert rear_extract([(1, 'Sudeep', 14), (2, 'Vandana', 36), (3, 'Dawood', 56)]) == [14, 36, 56]
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert substract_elements((10, 4, 5), (2, 5, 18)) == (8, -1, -13) assert substract_elements((11, 2, 3), (24, 45 ,16)) == (-13, -43, -13) assert substract_elements((7, 18, 9), (10, 11, 12)) == (-3, 7, -3)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function that takes in a positive integer n and finds the sum of even index binomial coefficients.
def check(candidate): assert even_binomial_Coeff_Sum(4) == 8 assert even_binomial_Coeff_Sum(6) == 32 assert even_binomial_Coeff_Sum(2) == 2
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function that takes in the radius and height of a cylinder and returns the the volume.
def check(candidate): assert math.isclose(volume_cylinder(10,5), 1570.7500000000002, rel_tol=0.001) assert math.isclose(volume_cylinder(4,5), 251.32000000000002, rel_tol=0.001) assert math.isclose(volume_cylinder(4,10), 502.64000000000004, rel_tol=0.001)
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): 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} assert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},180)=={ 'Alden Cantrell': 180, 'Pierre Cox': 190} assert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},190)=={ 'Pierre Cox': 190}
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the number of elements that occurs before the tuple element in the given tuple.
def check(candidate): assert count_first_elements((1, 5, 7, (4, 6), 10) ) == 3 assert count_first_elements((2, 9, (5, 7), 11) ) == 2 assert count_first_elements((11, 15, 5, 8, (2, 3), 8) ) == 4
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the nth decagonal number.
def check(candidate): assert is_num_decagonal(3) == 27 assert is_num_decagonal(7) == 175 assert is_num_decagonal(10) == 370
mbpp_sanitized
Write a unit test case for a Python function with description: 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).
def check(candidate): assert sequential_search([11,23,58,31,56,77,43,12,65,19],31) == (True, 3) assert sequential_search([12, 32, 45, 62, 35, 47, 44, 61],61) == (True, 7) assert sequential_search([9, 10, 17, 19, 22, 39, 48, 56],48) == (True, 6)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to check if the elements of a given list are unique or not.
def check(candidate): assert all_unique([1,2,3]) == True assert all_unique([1,2,1,2]) == False assert all_unique([1,2,3,4,5]) == True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to subtract two lists element-wise.
def check(candidate): assert sub_list([1, 2, 3],[4,5,6])==[-3,-3,-3] assert sub_list([1,2],[3,4])==[-2,-2] assert sub_list([90,120],[50,70])==[40,50]
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert validate(1234) == True assert validate(51241) == False assert validate(321) == True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function that takes in a list and element and checks whether all items in the list are equal to the given element.
def check(candidate): assert check_element(["green", "orange", "black", "white"],'blue')==False assert check_element([1,2,3,4],7)==False assert check_element(["green", "green", "green", "green"],'green')==True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function that checks whether a string contains the 'a' character followed by two or three 'b' characters.
def check(candidate): assert text_match_two_three("ac")==(False) assert text_match_two_three("dc")==(False) assert text_match_two_three("abbbba")==(True)
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert max_sub_array_sum_repeated([10, 20, -30, -1], 4, 3) == 30 assert max_sub_array_sum_repeated([-1, 10, 20], 3, 2) == 59 assert max_sub_array_sum_repeated([-1, -2, -3], 3, 3) == -1
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function takes in an integer n and returns the sum of squares of first n even natural numbers.
def check(candidate): assert square_Sum(2) == 20 assert square_Sum(3) == 56 assert square_Sum(4) == 120
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the list of maximum length in a list of lists.
def check(candidate): assert max_length([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(3, [13, 15, 17]) assert max_length([[1], [5, 7], [10, 12, 14,15]])==(4, [10, 12, 14,15]) assert max_length([[5], [15,20,25]])==(3, [15,20,25])
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert count_no_of_ways(2, 4) == 16 assert count_no_of_ways(3, 2) == 6 assert count_no_of_ways(4, 4) == 228
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find quotient of two numbers (rounded down to the nearest integer).
def check(candidate): assert find(10,3) == 3 assert find(4,2) == 2 assert find(20,5) == 4
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the third side of a right angled triangle.
def check(candidate): assert otherside_rightangle(7,8)==10.63014581273465 assert otherside_rightangle(3,4)==5 assert otherside_rightangle(7,15)==16.55294535724685
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the maximum value in a given heterogeneous list.
def check(candidate): assert max_val(['Python', 3, 2, 4, 5, 'version'])==5 assert max_val(['Python', 15, 20, 25])==25 assert max_val(['Python', 30, 20, 40, 50, 'version'])==50
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to return the sum of all divisors of a number.
def check(candidate): assert sum_div(8)==7 assert sum_div(12)==16 assert sum_div(7)==1
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to count inversions in an array.
def check(candidate): assert get_Inv_Count([1,20,6,4,5]) == 5 assert get_Inv_Count([1,2,1]) == 1 assert get_Inv_Count([1,2,5,6,1]) == 3
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to flatten a given nested list structure.
def check(candidate): 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] assert flatten_list([[10, 20], [40], [30, 56, 25], [10, 20], [33], [40]])==[10, 20, 40, 30, 56, 25, 10, 20, 33, 40] assert 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]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to calculate the maximum aggregate from the list of tuples.
def check(candidate): assert max_aggregate([('Juan Whelan',90),('Sabah Colley',88),('Peter Nichols',7),('Juan Whelan',122),('Sabah Colley',84)])==('Juan Whelan', 212) assert max_aggregate([('Juan Whelan',50),('Sabah Colley',48),('Peter Nichols',37),('Juan Whelan',22),('Sabah Colley',14)])==('Juan Whelan', 72) assert max_aggregate([('Juan Whelan',10),('Sabah Colley',20),('Peter Nichols',30),('Juan Whelan',40),('Sabah Colley',50)])==('Sabah Colley', 70)
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert math.isclose(count_binary_seq(1), 2.0, rel_tol=0.001) assert math.isclose(count_binary_seq(2), 6.0, rel_tol=0.001) assert math.isclose(count_binary_seq(3), 20.0, rel_tol=0.001)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the depth of a dictionary.
def check(candidate): assert dict_depth({'a':1, 'b': {'c': {'d': {}}}})==4 assert dict_depth({'a':1, 'b': {'c':'python'}})==2 assert dict_depth({1: 'Sun', 2: {3: {4:'Mon'}}})==3
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find element at a given index after number of rotations.
def check(candidate): assert find_Element([1,2,3,4,5],[[0,2],[0,3]],2,1) == 3 assert find_Element([1,2,3,4],[[0,1],[0,2]],1,2) == 3 assert find_Element([1,2,3,4,5,6],[[0,1],[0,2]],1,1) == 1
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to return two words from a list of words starting with letter 'p'.
def check(candidate): assert start_withp(["Python PHP", "Java JavaScript", "c c++"])==('Python', 'PHP') assert start_withp(["Python Programming","Java Programming"])==('Python','Programming') assert start_withp(["Pqrst Pqr","qrstuv"])==('Pqrst','Pqr')
mbpp_sanitized
Write a unit test case for a Python function with description: 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 .
def check(candidate): assert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 4, 6) == 11 assert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 2, 5) == 7 assert max_sum_increasing_subseq([11, 15, 19, 21, 26, 28, 31], 7, 2, 4) == 71
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to get a colon of a tuple.
def check(candidate): assert colon_tuplex(("HELLO", 5, [], True) ,2,50)==("HELLO", 5, [50], True) assert colon_tuplex(("HELLO", 5, [], True) ,2,100)==(("HELLO", 5, [100],True)) assert colon_tuplex(("HELLO", 5, [], True) ,2,500)==("HELLO", 5, [500], True)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the specified number of largest products from two given lists, selecting one factor from each list.
def check(candidate): assert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],3)==[60, 54, 50] assert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],4)==[60, 54, 50, 48] assert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],5)==[60, 54, 50, 48, 45]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the maximum of two numbers.
def check(candidate): assert maximum(5,10) == 10 assert maximum(-1,-2) == -1 assert maximum(9,7) == 9
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to convert a given string to a tuple of characters.
def check(candidate): assert string_to_tuple("python 3.0")==('p', 'y', 't', 'h', 'o', 'n', '3', '.', '0') assert string_to_tuple("item1")==('i', 't', 'e', 'm', '1') assert string_to_tuple("15.10")==('1', '5', '.', '1', '0')
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to set the left most unset bit.
def check(candidate): assert set_left_most_unset_bit(10) == 14 assert set_left_most_unset_bit(12) == 14 assert set_left_most_unset_bit(15) == 15
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the volume of a cone.
def check(candidate): assert math.isclose(volume_cone(5,12), 314.15926535897927, rel_tol=0.001) assert math.isclose(volume_cone(10,15), 1570.7963267948965, rel_tol=0.001) assert math.isclose(volume_cone(19,17), 6426.651371693521, rel_tol=0.001)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the highest power of 2 that is less than or equal to n.
def check(candidate): assert highest_Power_of_2(10) == 8 assert highest_Power_of_2(19) == 16 assert highest_Power_of_2(32) == 32
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the n'th lucas number.
def check(candidate): assert find_lucas(9) == 76 assert find_lucas(4) == 7 assert find_lucas(3) == 4
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to apply a given format string to all of the elements in a list.
def check(candidate): assert add_string([1,2,3,4],'temp{0}')==['temp1', 'temp2', 'temp3', 'temp4'] assert add_string(['a','b','c','d'], 'python{0}')==[ 'pythona', 'pythonb', 'pythonc', 'pythond'] assert add_string([5,6,7,8],'string{0}')==['string5', 'string6', 'string7', 'string8']
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to convert more than one list to nested dictionary.
def check(candidate): 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}}] assert 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}}] assert 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}}]
mbpp_sanitized
Write a unit test case for a Python function with description: 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).
def check(candidate): assert get_max_sum(60) == 106 assert get_max_sum(10) == 12 assert get_max_sum(2) == 2
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the list with maximum length.
def check(candidate): assert max_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(3, [13, 15, 17]) assert max_length_list([[1,2,3,4,5],[1,2,3,4],[1,2,3],[1,2],[1]])==(5,[1,2,3,4,5]) assert max_length_list([[3,4,5],[6,7,8,9],[10,11,12]])==(4,[6,7,8,9])
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to check if given tuple contains no duplicates.
def check(candidate): assert check_distinct((1, 4, 5, 6, 1, 4)) == False assert check_distinct((1, 4, 5, 6)) == True assert check_distinct((2, 3, 4, 5, 6)) == True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the first non-repeated character in a given string.
def check(candidate): assert first_non_repeating_character("abcabc") == None assert first_non_repeating_character("abc") == "a" assert first_non_repeating_character("ababc") == "c"
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to check whether the given string starts and ends with the same character or not.
def check(candidate): assert check_char("abba") == "Valid" assert check_char("a") == "Valid" assert check_char("abcd") == "Invalid"
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the median of three numbers.
def check(candidate): assert median_numbers(25,55,65)==55.0 assert median_numbers(20,10,30)==20.0 assert median_numbers(15,45,75)==45.0
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to compute the sum of digits of each number of a given list.
def check(candidate): assert sum_of_digits([10,2,56])==14 assert sum_of_digits([[10,20,4,5,'b',70,'a']])==19 assert sum_of_digits([10,20,-4,5,-70])==19
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to perform the mathematical bitwise xor operation across the given tuples.
def check(candidate): assert bitwise_xor((10, 4, 6, 9), (5, 2, 3, 3)) == (15, 6, 5, 10) assert bitwise_xor((11, 5, 7, 10), (6, 3, 4, 4)) == (13, 6, 3, 14) assert bitwise_xor((12, 6, 8, 11), (7, 4, 5, 6)) == (11, 2, 13, 13)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to extract the number of unique tuples in the given list.
def check(candidate): assert extract_freq([(3, 4), (1, 2), (4, 3), (5, 6)] ) == 3 assert extract_freq([(4, 15), (2, 3), (5, 4), (6, 7)] ) == 4 assert extract_freq([(5, 16), (2, 3), (6, 5), (6, 9)] ) == 4
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to perform index wise addition of tuple elements in the given two nested tuples.
def check(candidate): 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)) assert 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)) assert 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))
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the minimum of two numbers.
def check(candidate): assert minimum(1,2) == 1 assert minimum(-5,-4) == -5 assert minimum(0,0) == 0
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to check whether an element exists within a tuple.
def check(candidate): assert check_tuplex(("w", 3, "r", "e", "s", "o", "u", "r", "c", "e"),'r')==True assert check_tuplex(("w", 3, "r", "e", "s", "o", "u", "r", "c", "e"),'5')==False assert check_tuplex(("w", 3, "r", "e", "s", "o", "u", "r", "c","e"),3)==True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find whether the parity of a given number is odd.
def check(candidate): assert find_Parity(12) == False assert find_Parity(7) == True assert find_Parity(10) == False
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to create the next bigger number by rearranging the digits of a given number.
def check(candidate): assert rearrange_bigger(12)==21 assert rearrange_bigger(10)==False assert rearrange_bigger(102)==120
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert k_smallest_pairs([1,3,7],[2,4,6],2)==[[1, 2], [1, 4]] assert k_smallest_pairs([1,3,7],[2,4,6],1)==[[1, 2]] assert k_smallest_pairs([1,3,7],[2,4,6],7)==[[1, 2], [1, 4], [3, 2], [1, 6], [3, 4], [3, 6], [7, 2]]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the minimum product from the pairs of tuples within a given list.
def check(candidate): assert min_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==8 assert min_product_tuple([(10,20), (15,2), (5,10)] )==30 assert min_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==100
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the minimum value in a given heterogeneous list.
def check(candidate): assert min_val(['Python', 3, 2, 4, 5, 'version'])==2 assert min_val(['Python', 15, 20, 25])==15 assert min_val(['Python', 30, 20, 40, 50, 'version'])==20
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to convert the given snake case string to camel case string.
def check(candidate): assert snake_to_camel('android_tv') == 'AndroidTv' assert snake_to_camel('google_pixel') == 'GooglePixel' assert snake_to_camel('apple_watch') == 'AppleWatch'
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to remove odd numbers from a given list.
def check(candidate): assert remove_odd([1,2,3]) == [2] assert remove_odd([2,4,6]) == [2,4,6] assert remove_odd([10,20,3]) == [10,20]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to extract the nth element from a given list of tuples.
def check(candidate): 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'] assert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,2)==[99, 96, 94, 98] assert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)],1)==[98, 97, 91, 94]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to check whether any value in a sequence exists in a sequence or not.
def check(candidate): assert overlapping([1,2,3,4,5],[6,7,8,9]) == False assert overlapping([1,2,3],[4,5,6]) == False assert overlapping([1,4,5],[1,4,5]) == True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find a pair with highest product from a given array of integers.
def check(candidate): assert max_Product([1,2,3,4,7,0,8,4]) == (7,8) assert max_Product([0,-1,-2,-4,5,0,-6]) == (-4,-6) assert max_Product([1,2,3]) == (2,3)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find common first element in given list of tuple.
def check(candidate): assert group_tuples([('x', 'y'), ('x', 'z'), ('w', 't')]) == [('x', 'y', 'z'), ('w', 't')] assert group_tuples([('a', 'b'), ('a', 'c'), ('d', 'e')]) == [('a', 'b', 'c'), ('d', 'e')] assert group_tuples([('f', 'g'), ('f', 'g'), ('h', 'i')]) == [('f', 'g', 'g'), ('h', 'i')]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the element of a list having maximum length.
def check(candidate): assert Find_Max([['A'],['A','B'],['A','B','C']]) == ['A','B','C'] assert Find_Max([[1],[1,2],[1,2,3]]) == [1,2,3] assert Find_Max([[1,1],[1,2,3],[1,5,6,1]]) == [1,5,6,1]
mbpp_sanitized
Write a unit test case for a Python function with description: 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.
def check(candidate): assert round_and_sum([22.4, 4.0, -16.22, -9.10, 11.00, -12.22, 14.20, -5.20, 17.50])==243 assert round_and_sum([5,2,9,24.3,29])==345 assert round_and_sum([25.0,56.7,89.2])==513
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the cube sum of first n even natural numbers.
def check(candidate): assert cube_Sum(2) == 72 assert cube_Sum(3) == 288 assert cube_Sum(4) == 800
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to concatenate each element of tuple by the delimiter.
def check(candidate): assert concatenate_tuple(("ID", "is", 4, "UTS") ) == 'ID-is-4-UTS' assert concatenate_tuple(("QWE", "is", 4, "RTY") ) == 'QWE-is-4-RTY' assert concatenate_tuple(("ZEN", "is", 4, "OP") ) == 'ZEN-is-4-OP'
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the average of cubes of first n natural numbers.
def check(candidate): assert find_Average_Of_Cube(2) == 4.5 assert find_Average_Of_Cube(3) == 12 assert find_Average_Of_Cube(1) == 1
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to extract only the rear index element of each string in the given tuple.
def check(candidate): assert extract_rear(('Mers', 'for', 'Vers') ) == ['s', 'r', 's'] assert extract_rear(('Avenge', 'for', 'People') ) == ['e', 'r', 'e'] assert extract_rear(('Gotta', 'get', 'go') ) == ['a', 't', 'o']
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to count the number of sublists containing a particular element.
def check(candidate): assert count_element_in_list([[1, 3], [5, 7], [1, 11], [1, 15, 7]],1)==3 assert count_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'A')==3 assert count_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'E')==1
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to filter odd numbers.
def check(candidate): assert filter_oddnumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1,3,5,7,9] assert filter_oddnumbers([10,20,45,67,84,93])==[45,67,93] assert filter_oddnumbers([5,7,9,8,6,4,3])==[5,7,9,3]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format.
def check(candidate): assert change_date_format("2026-01-02") == '02-01-2026' assert change_date_format("2020-11-13") == '13-11-2020' assert change_date_format("2021-04-26") == '26-04-2021'
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to sort the given array by using shell sort.
def check(candidate): assert shell_sort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) == [2, 3, 4, 5, 12, 12, 23, 56, 81, 95] assert shell_sort([24, 22, 39, 34, 87, 73, 68]) == [22, 24, 34, 39, 68, 73, 87] assert shell_sort([32, 30, 16, 96, 82, 83, 74]) == [16, 30, 32, 74, 82, 83, 96]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to extract the elementwise and tuples from the given two tuples.
def check(candidate): assert and_tuples((10, 4, 6, 9), (5, 2, 3, 3)) == (0, 0, 2, 1) assert and_tuples((1, 2, 3, 4), (5, 6, 7, 8)) == (1, 2, 3, 0) assert and_tuples((8, 9, 11, 12), (7, 13, 14, 17)) == (0, 9, 10, 0)
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the directrix of a parabola.
def check(candidate): assert parabola_directrix(5,3,2)==-198 assert parabola_directrix(9,8,4)==-2336 assert parabola_directrix(2,4,6)==-130
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function that takes two lists and returns true if they have at least one common element.
def check(candidate): assert common_element([1,2,3,4,5], [5,6,7,8,9])==True assert common_element([1,2,3,4,5], [6,7,8,9])==None assert common_element(['a','b','c'], ['d','b','e'])==True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the median length of a trapezium.
def check(candidate): assert median_trapezium(15,25,35)==20 assert median_trapezium(10,20,30)==15 assert median_trapezium(6,9,4)==7.5
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to check whether the entered number is greater than the elements of the given array.
def check(candidate): assert check_greater([1, 2, 3, 4, 5], 4) == False assert check_greater([2, 3, 4, 5, 6], 8) == True assert check_greater([9, 7, 4, 8, 6, 1], 11) == True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function that matches a string that has an a followed by one or more b's.
def check(candidate): assert text_match_one("ac")==False assert text_match_one("dc")==False assert text_match_one("abba")==True
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the last digit of a given number.
def check(candidate): assert last_Digit(123) == 3 assert last_Digit(25) == 5 assert last_Digit(30) == 0
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to return the negative numbers in a list.
def check(candidate): assert neg_nos([-1,4,5,-6]) == [-1,-6] assert neg_nos([-1,-2,3,4]) == [-1,-2] assert neg_nos([-7,-6,8,9]) == [-7,-6]
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to remove odd characters in a string.
def check(candidate): assert remove_odd("python")==("yhn") assert remove_odd("program")==("rga") assert remove_odd("language")==("agae")
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to count bidirectional tuple pairs.
def check(candidate): assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 3 assert count_bidirectional([(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 2 assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 2), (6, 5), (2, 1)] ) == 4
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to join a list of multiple integers into a single integer.
def check(candidate): assert multiple_to_single([11, 33, 50])==113350 assert multiple_to_single([-1,2,3,4,5,6])==-123456 assert multiple_to_single([10,15,20,25])==10152025
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the first adverb and their positions in a given sentence.
def check(candidate): assert find_adverb_position("clearly!! we can see the sky")==(0, 7, 'clearly') assert find_adverb_position("seriously!! there are many roses")==(0, 9, 'seriously') assert find_adverb_position("unfortunately!! sita is going to home")==(0, 13, 'unfortunately')
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the surface area of a cube of a given size.
def check(candidate): assert surfacearea_cube(5)==150 assert surfacearea_cube(3)==54 assert surfacearea_cube(10)==600
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find the ration of positive numbers in an array of integers.
def check(candidate): assert positive_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8])==0.54 assert positive_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==0.69 assert positive_count([2, 4, -6, -9, 11, -12, 14, -5, 17])==0.56
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to find the largest negative number from the given list.
def check(candidate): assert largest_neg([1,2,3,-4,-6]) == -6 assert largest_neg([1,2,3,-8,-9]) == -9 assert largest_neg([1,2,3,4,-1]) == -1
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to trim each tuple by k in the given tuple list.
def check(candidate): 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,)]' assert 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)]' assert 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)]'
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to perform index wise multiplication of tuple elements in the given two tuples.
def check(candidate): 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)) assert 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)) assert 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))
mbpp_sanitized
Write a unit test case for a Python function with description: Write a python function to count the occurence of all elements of list in a tuple.
def check(candidate): assert count_Occurrence(('a', 'a', 'c', 'b', 'd'),['a', 'b'] ) == 3 assert count_Occurrence((1, 2, 3, 1, 4, 6, 7, 1, 4),[1, 4, 7]) == 6 assert count_Occurrence((1,2,3,4,5,6),[1,2]) == 2
mbpp_sanitized
Write a unit test case for a Python function with description: Write a function to find cubes of individual elements in a list.
def check(candidate): assert cube_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000] assert cube_nums([10,20,30])==([1000, 8000, 27000]) assert cube_nums([12,15])==([1728, 3375])
mbpp_sanitized