Dataset Viewer
Auto-converted to Parquet Duplicate
messages
listlengths
1
1
ground_truth
stringlengths
74
4.16k
dataset
stringclasses
1 value
[ { "content": "Write a python function to remove first and last occurrence of a given character from the string.", "role": "user" } ]
["assert remove_Occ(\"hello\",\"l\") == \"heo\"", "assert remove_Occ(\"abcda\",\"a\") == \"bcd\"", "assert remove_Occ(\"PHP\",\"P\") == \"H\""]
code
[ { "content": "Write a function to sort a given matrix in ascending order according to the sum of its rows.", "role": "user" } ]
["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]]"]
code
[ { "content": "Write a function to count the most common words in a dictionary.", "role": "user" } ]
["assert count_common(['red','green','black','pink','black','white','black','eyes','white','black','orange','pink','pink','red','red','white','orange','white',\"black\",'pink','green','green','pink','green','pink','white','orange',\"orange\",'red']) == [('pink', 6), ('black', 5), ('white', 5), ('red', 4)]", "assert count_common(['one', 'two', 'three', 'four', 'five', 'one', 'two', 'one', 'three', 'one']) == [('one', 4), ('two', 2), ('three', 2), ('four', 1)]", "assert count_common(['Facebook', 'Apple', 'Amazon', 'Netflix', 'Google', 'Apple', 'Netflix', 'Amazon']) == [('Apple', 2), ('Amazon', 2), ('Netflix', 2), ('Facebook', 1)]"]
code
[ { "content": "Write a python function to find the volume of a triangular prism.", "role": "user" } ]
["assert find_Volume(10,8,6) == 240", "assert find_Volume(3,2,2) == 6", "assert find_Volume(1,2,1) == 1"]
code
[ { "content": "Write a function to split a string at lowercase letters.", "role": "user" } ]
["assert split_lowerstring(\"AbCd\")==['bC','d']", "assert split_lowerstring(\"Python\")==['y', 't', 'h', 'o', 'n']", "assert split_lowerstring(\"Programming\")==['r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g']"]
code
[ { "content": "Write a function to find sequences of lowercase letters joined with an underscore.", "role": "user" } ]
["assert text_lowercase_underscore(\"aab_cbbbc\")==('Found a match!')", "assert text_lowercase_underscore(\"aab_Abbbc\")==('Not matched!')", "assert text_lowercase_underscore(\"Aaab_abbbc\")==('Not matched!')"]
code
[ { "content": "Write a function to find the perimeter of a square.", "role": "user" } ]
["assert square_perimeter(10)==40", "assert square_perimeter(5)==20", "assert square_perimeter(4)==16"]
code
[ { "content": "Write a function to remove characters from the first string which are present in the second string.", "role": "user" } ]
["assert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'", "assert remove_dirty_chars(\"digitalindia\", \"talent\") == 'digiidi'", "assert remove_dirty_chars(\"exoticmiles\", \"toxic\") == 'emles' "]
code
[ { "content": "Write a function to find whether a given array of integers contains any duplicate element.", "role": "user" } ]
["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"]
code
[ { "content": "Write a function to check if the given number is woodball or not.", "role": "user" } ]
["assert is_woodall(383) == True", "assert is_woodall(254) == False", "assert is_woodall(200) == False"]
code
[ { "content": "Write a function to find m number of multiples of n.", "role": "user" } ]
["assert multiples_of_num(4,3)== [3,6,9,12]", "assert multiples_of_num(2,5)== [5,10]", "assert multiples_of_num(9,2)== [2,4,6,8,10,12,14,16,18]"]
code
[ { "content": "Write a function to find the first duplicate element in a given array of integers.", "role": "user" } ]
["assert find_first_duplicate(([1, 2, 3, 4, 4, 5]))==4", "assert find_first_duplicate([1, 2, 3, 4])==-1", "assert find_first_duplicate([1, 1, 2, 3, 3, 2, 2])==1"]
code
[ { "content": "Write a python function to find the maximum sum of elements of list in a list of lists.", "role": "user" } ]
["assert maximum_Sum([[1,2,3],[4,5,6],[10,11,12],[7,8,9]]) == 33", "assert maximum_Sum([[0,1,1],[1,1,2],[3,2,1]]) == 6", "assert maximum_Sum([[0,1,3],[1,2,1],[9,8,2],[0,1,0],[6,4,8]]) == 19"]
code
[ { "content": "Write a function to convert the given binary number to its decimal equivalent.", "role": "user" } ]
["assert binary_to_decimal(100) == 4", "assert binary_to_decimal(1011) == 11", "assert binary_to_decimal(1101101) == 109"]
code
[ { "content": "Write a python function to find the product of non-repeated elements in a given array.", "role": "user" } ]
["assert find_Product([1,1,2,3],4) == 6", "assert find_Product([1,2,3,1,1],5) == 6", "assert find_Product([1,1,4,5,6],5) == 120"]
code
[ { "content": "Write a function to check if the given tuple list has all k elements.", "role": "user" } ]
["assert check_k_elements([(4, 4), (4, 4, 4), (4, 4), (4, 4, 4, 4), (4, )], 4) == True", "assert check_k_elements([(7, 7, 7), (7, 7)], 7) == True", "assert check_k_elements([(9, 9), (9, 9, 9, 9)], 7) == False"]
code
[ { "content": "Write a python function to remove all digits from a list of strings.", "role": "user" } ]
["assert remove(['4words', '3letters', '4digits']) == ['words', 'letters', 'digits']", "assert remove(['28Jan','12Jan','11Jan']) == ['Jan','Jan','Jan']", "assert remove(['wonder1','wonder2','wonder3']) == ['wonder','wonder','wonder']"]
code
[ { "content": "Write a python function to find binomial co-efficient.", "role": "user" } ]
["assert binomial_Coeff(5,2) == 10", "assert binomial_Coeff(4,3) == 4", "assert binomial_Coeff(3,2) == 3"]
code
[ { "content": "Write a python function to find the element occurring odd number of times.", "role": "user" } ]
["assert get_Odd_Occurrence([1,2,3,1,2,3,1],7) == 1", "assert get_Odd_Occurrence([1,2,3,2,3,1,3],7) == 3", "assert get_Odd_Occurrence([2,3,5,4,5,2,4,3,5,2,4,4,2],13) == 5"]
code
[ { "content": "Write a python function to count all the substrings starting and ending with same characters.", "role": "user" } ]
["assert count_Substring_With_Equal_Ends(\"abc\") == 3", "assert count_Substring_With_Equal_Ends(\"abcda\") == 6", "assert count_Substring_With_Equal_Ends(\"ab\") == 2"]
code
[ { "content": "Write a function to find the top k integers that occur most frequently from given lists of sorted and distinct integers using heap queue algorithm.", "role": "user" } ]
["assert func([[1, 2, 6], [1, 3, 4, 5, 7, 8], [1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12]],3)==[5, 7, 1]", "assert func([[1, 2, 6], [1, 3, 4, 5, 7, 8], [1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12]],1)==[1]", "assert func([[1, 2, 6], [1, 3, 4, 5, 7, 8], [1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12]],5)==[6, 5, 7, 8, 1]"]
code
[ { "content": "Write a python function to find the largest prime factor of a given number.", "role": "user" } ]
["assert max_Prime_Factors(15) == 5", "assert max_Prime_Factors(6) == 3", "assert max_Prime_Factors(2) == 2"]
code
[ { "content": "Write a python function to convert a decimal number to binary number.", "role": "user" } ]
["assert decimal_To_Binary(10) == 1010", "assert decimal_To_Binary(1) == 1", "assert decimal_To_Binary(20) == 10100"]
code
[ { "content": "Write a python function to find the missing number in a sorted array.", "role": "user" } ]
["assert find_missing([1,2,3,5],4) == 4", "assert find_missing([1,3,4,5],4) == 2", "assert find_missing([1,2,3,5,6,7],5) == 4"]
code
[ { "content": "Write a function to find the n-th rectangular number.", "role": "user" } ]
["assert find_rect_num(4) == 20", "assert find_rect_num(5) == 30", "assert find_rect_num(6) == 42"]
code
[ { "content": "Write a python function to find the nth digit in the proper fraction of two given numbers.", "role": "user" } ]
["assert find_Nth_Digit(1,2,1) == 5", "assert find_Nth_Digit(3,5,1) == 6", "assert find_Nth_Digit(5,6,5) == 3"]
code
[ { "content": "Write a function to sort a given mixed list of integers and strings.", "role": "user" } ]
["assert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']", "assert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']", "assert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']"]
code
[ { "content": "Write a function to find the division of first even and odd number of a given list.", "role": "user" } ]
["assert div_even_odd([1,3,5,7,4,1,6,8])==4", "assert div_even_odd([1,2,3,4,5,6,7,8,9,10])==2", "assert div_even_odd([1,5,7,9,10])==10"]
code
[ { "content": "Write a function to check if the letters of a given string can be rearranged so that two characters that are adjacent to each other are different.", "role": "user" } ]
["assert rearange_string(\"aab\")==('aba')", "assert rearange_string(\"aabb\")==('abab')", "assert rearange_string(\"abccdd\")==('cdabcd')"]
code
[ { "content": "Write a function to find frequency of the elements in a given list of lists using collections module.", "role": "user" } ]
["assert freq_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]])==({2: 3, 1: 2, 5: 2, 3: 1, 4: 1, 6: 1, 7: 1, 9: 1})", "assert freq_element([[1,2,3,4],[5,6,7,8],[9,10,11,12]])==({1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1})", "assert freq_element([[15,20,30,40],[80,90,100,110],[30,30,80,90]])==({30: 3, 80: 2, 90: 2, 15: 1, 20: 1, 40: 1, 100: 1, 110: 1})"]
code
[ { "content": "Write a function to filter even numbers using lambda function.", "role": "user" } ]
["assert filter_evennumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[2, 4, 6, 8, 10]", "assert filter_evennumbers([10,20,45,67,84,93])==[10,20,84]", "assert filter_evennumbers([5,7,9,8,6,4,3])==[8,6,4]"]
code
[ { "content": "Write a python function to find the sum of repeated elements in a given array.", "role": "user" } ]
["assert find_Sum([1,2,3,1,1,4,5,6],8) == 3", "assert find_Sum([1,2,3,1,1],5) == 3", "assert find_Sum([1,1,2],3) == 2"]
code
[ { "content": "Write a function to find sequences of lowercase letters joined with an underscore using regex.", "role": "user" } ]
["assert text_match(\"aab_cbbbc\") == 'Found a match!'", "assert text_match(\"aab_Abbbc\") == 'Not matched!'", "assert text_match(\"Aaab_abbbc\") == 'Not matched!'"]
code
[ { "content": "Write a function that matches a word at the beginning of a string.", "role": "user" } ]
["assert text_match_string(\" python\")==('Not matched!')", "assert text_match_string(\"python\")==('Found a match!')", "assert text_match_string(\" lang\")==('Not matched!')"]
code
[ { "content": "Write a function to find the gcd of the given array elements.", "role": "user" } ]
["assert get_gcd([2, 4, 6, 8, 16]) == 2", "assert get_gcd([1, 2, 3]) == 1", "assert get_gcd([2, 4, 6, 8]) == 2 "]
code
[ { "content": "Write a python function to determine whether all the numbers are different from each other are not.", "role": "user" } ]
["assert test_distinct([1,5,7,9]) == True", "assert test_distinct([2,4,5,5,7,9]) == False", "assert test_distinct([1,2,3]) == True"]
code
[ { "content": "Write a python function to find the last digit when factorial of a divides factorial of b.", "role": "user" } ]
["assert compute_Last_Digit(2,4) == 2", "assert compute_Last_Digit(6,8) == 6", "assert compute_Last_Digit(1,2) == 2"]
code
[ { "content": "Write a python function to set all odd bits of a given number.", "role": "user" } ]
["assert odd_bit_set_number(10) == 15", "assert odd_bit_set_number(20) == 21", "assert odd_bit_set_number(30) == 31"]
code
[ { "content": "Write a function to extract every first or specified element from a given two-dimensional list.", "role": "user" } ]
["assert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],0)==[1, 4, 7]", "assert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],2)==[3, 6, 9]", "assert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],1)==[2,5,1]"]
code
[ { "content": "Write a function to find the list with minimum length using lambda function.", "role": "user" } ]
["assert min_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(1, [0])", "assert min_length_list([[1,2,3,4,5],[1,2,3,4],[1,2,3],[1,2],[1]])==(1,[1])", "assert min_length_list([[3,4,5],[6,7,8,9],[10,11,12],[1,2]])==(2,[1,2])"]
code
[ { "content": "Write a function to print check if the triangle is equilateral or not.", "role": "user" } ]
["assert check_equilateral(6,8,12)==False ", "assert check_equilateral(6,6,12)==False", "assert check_equilateral(6,6,6)==True"]
code
[ { "content": "Write a function to caluclate area of a parallelogram.", "role": "user" } ]
["assert parallelogram_area(10,20)==200", "assert parallelogram_area(15,20)==300", "assert parallelogram_area(8,9)==72"]
code
[ { "content": "Write a python function to check whether the first and last characters of a given string are equal or not.", "role": "user" } ]
["assert check_Equality(\"abcda\") == \"Equal\"", "assert check_Equality(\"ab\") == \"Not Equal\"", "assert check_Equality(\"mad\") == \"Not Equal\""]
code
[ { "content": "Write a function to sort the given array by using counting sort.", "role": "user" } ]
["assert counting_sort([1,23,4,5,6,7,8]) == [1, 4, 5, 6, 7, 8, 23]", "assert counting_sort([12, 9, 28, 33, 69, 45]) == [9, 12, 28, 33, 45, 69]", "assert counting_sort([8, 4, 14, 3, 2, 1]) == [1, 2, 3, 4, 8, 14]"]
code
[ { "content": "Write a function to find t-nth term of geometric series.", "role": "user" } ]
["assert tn_gp(1,5,2)==16", "assert tn_gp(1,5,4)==256", "assert tn_gp(2,6,3)==486"]
code
[ { "content": "Write a python function to check if a given number is one less than twice its reverse.", "role": "user" } ]
["assert check(70) == False", "assert check(23) == False", "assert check(73) == True"]
code
[ { "content": "Write a python function to find the largest number that can be formed with the given digits.", "role": "user" } ]
["assert find_Max_Num([1,2,3],3) == 321", "assert find_Max_Num([4,5,6,1],4) == 6541", "assert find_Max_Num([1,2,3,9],4) == 9321"]
code
[ { "content": "Write a python function to check whether the given two integers have opposite sign or not.", "role": "user" } ]
["assert opposite_Signs(1,-2) == True", "assert opposite_Signs(3,2) == False", "assert opposite_Signs(-10,-10) == False"]
code
[ { "content": "Write a function to find the nth octagonal number.", "role": "user" } ]
["assert is_octagonal(5) == 65", "assert is_octagonal(10) == 280", "assert is_octagonal(15) == 645"]
code
[ { "content": "Write a function to find the maximum length of the subsequence with difference between adjacent elements for the given array.", "role": "user" } ]
["assert max_len_sub([2, 5, 6, 3, 7, 6, 5, 8], 8) == 5", "assert max_len_sub([-2, -1, 5, -1, 4, 0, 3], 7) == 4", "assert max_len_sub([9, 11, 13, 15, 18], 5) == 1"]
code
[ { "content": "Write a python function to count number of substrings with the sum of digits equal to their length.", "role": "user" } ]
["assert count_Substrings('112112',6) == 6", "assert count_Substrings('111',3) == 6", "assert count_Substrings('1101112',7) == 12"]
code
[ { "content": "Write a python function to find smallest number in a list.", "role": "user" } ]
["assert smallest_num([10, 20, 1, 45, 99]) == 1", "assert smallest_num([1, 2, 3]) == 1", "assert smallest_num([45, 46, 50, 60]) == 45"]
code
[ { "content": "Write a function to find the maximum difference between available pairs in the given tuple list.", "role": "user" } ]
["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"]
code
[ { "content": "Write a function to sort a list of tuples using lambda.", "role": "user" } ]
["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)])"]
code
[ { "content": "Write a function of recursion list sum.", "role": "user" } ]
["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"]
code
[ { "content": "Write a python function to count positive numbers in a list.", "role": "user" } ]
["assert pos_count([1,-2,3,-4]) == 2", "assert pos_count([3,4,5,-1]) == 3", "assert pos_count([1,2,3,4]) == 4"]
code
[ { "content": "Write a function to find the number of ways to partition a set of bell numbers.", "role": "user" } ]
["assert bell_number(2)==2", "assert bell_number(10)==115975", "assert bell_number(56)==6775685320645824322581483068371419745979053216268760300"]
code
[ { "content": "Write a python function to check whether the given array is monotonic or not.", "role": "user" } ]
["assert is_Monotonic([6, 5, 4, 4]) == True", "assert is_Monotonic([1, 2, 2, 3]) == True", "assert is_Monotonic([1, 3, 2]) == False"]
code
[ { "content": "Write a function to check whether a list contains the given sublist or not.", "role": "user" } ]
["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"]
code
[ { "content": "Write a function to find whether all the given tuples have equal length or not.", "role": "user" } ]
["assert get_equal([(11, 22, 33), (44, 55, 66)], 3) == 'All tuples have same length'", "assert get_equal([(1, 2, 3), (4, 5, 6, 7)], 3) == 'All tuples do not have same length'", "assert get_equal([(1, 2), (3, 4)], 2) == 'All tuples have same length'"]
code
[ { "content": "Write a function to sort a list of elements using comb sort.", "role": "user" } ]
["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]"]
code
[ { "content": "Write a python function to check whether the given number can be represented as difference of two squares or not.", "role": "user" } ]
["assert dif_Square(5) == True", "assert dif_Square(10) == False", "assert dif_Square(15) == True"]
code
[ { "content": "Write a function to split the given string with multiple delimiters by using regex.", "role": "user" } ]
["assert multiple_split('Forces of the \\ndarkness*are coming into the play.') == ['Forces of the ', 'darkness', 'are coming into the play.']", "assert multiple_split('Mi Box runs on the \\n Latest android*which has google assistance and chromecast.') == ['Mi Box runs on the ', ' Latest android', 'which has google assistance and chromecast.']", "assert multiple_split('Certain services\\nare subjected to change*over the seperate subscriptions.') == ['Certain services', 'are subjected to change', 'over the seperate subscriptions.']"]
code
[ { "content": "Write a function to check whether it follows the sequence given in the patterns array.", "role": "user" } ]
["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 "]
code
[ { "content": "Write a function to find tuples which have all elements divisible by k from the given list of tuples.", "role": "user" } ]
["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)]'"]
code
[ { "content": "Write a python function to count the number of squares in a rectangle.", "role": "user" } ]
["assert count_Squares(4,3) == 20", "assert count_Squares(2,2) == 5", "assert count_Squares(1,1) == 1"]
code
[ { "content": "Write a python function to find the difference between sum of even and odd digits.", "role": "user" } ]
["assert is_Diff (12345) == False", "assert is_Diff(1212112) == True", "assert is_Diff(1212) == False"]
code
[ { "content": "Write a python function to find number of integers with odd number of set bits.", "role": "user" } ]
["assert count_With_Odd_SetBits(5) == 3", "assert count_With_Odd_SetBits(10) == 5", "assert count_With_Odd_SetBits(15) == 8"]
code
[ { "content": "Write a python function to check whether the length of the word is odd or not.", "role": "user" } ]
["assert word_len(\"Hadoop\") == False", "assert word_len(\"great\") == True", "assert word_len(\"structure\") == True"]
code
[ { "content": "Write a function to find the nth tetrahedral number.", "role": "user" } ]
["assert tetrahedral_number(5) == 35.0", "assert tetrahedral_number(6) == 56.0", "assert tetrahedral_number(7) == 84.0"]
code
[ { "content": "Write a function to zip the two given tuples.", "role": "user" } ]
["assert zip_tuples((7, 8, 4, 5, 9, 10),(1, 5, 6) ) == [(7, 1), (8, 5), (4, 6), (5, 1), (9, 5), (10, 6)]", "assert zip_tuples((8, 9, 5, 6, 10, 11),(2, 6, 7) ) == [(8, 2), (9, 6), (5, 7), (6, 2), (10, 6), (11, 7)]", "assert zip_tuples((9, 10, 6, 7, 11, 12),(3, 7, 8) ) == [(9, 3), (10, 7), (6, 8), (7, 3), (11, 7), (12, 8)]"]
code
[ { "content": "Write a function to find the volume of a sphere.", "role": "user" } ]
["assert volume_sphere(10)==4188.790204786391", "assert volume_sphere(25)==65449.84694978735", "assert volume_sphere(20)==33510.32163829113"]
code
[ { "content": "Write a python function to find the character made by adding all the characters of the given string.", "role": "user" } ]
["assert get_Char(\"abc\") == \"f\"", "assert get_Char(\"gfg\") == \"t\"", "assert get_Char(\"ab\") == \"c\""]
code
[ { "content": "Write a function to find the n-th number in newman conway sequence.", "role": "user" } ]
["assert sequence(10) == 6", "assert sequence(2) == 1", "assert sequence(3) == 2"]
code
[ { "content": "Write a function to find the surface area of a sphere.", "role": "user" } ]
["assert surfacearea_sphere(10)==1256.6370614359173", "assert surfacearea_sphere(15)==2827.4333882308138", "assert surfacearea_sphere(20)==5026.548245743669"]
code
[ { "content": "Write a function to find nth centered hexagonal number.", "role": "user" } ]
["assert centered_hexagonal_number(10) == 271", "assert centered_hexagonal_number(2) == 7", "assert centered_hexagonal_number(9) == 217"]
code
[ { "content": "Write a function to merge three dictionaries into a single expression.", "role": "user" } ]
["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'}"]
code
[ { "content": "Write a function to get the frequency of the elements in a list.", "role": "user" } ]
["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}) "]
code
[ { "content": "Write a function to find the closest smaller number than n.", "role": "user" } ]
["assert closest_num(11) == 10", "assert closest_num(7) == 6", "assert closest_num(12) == 11"]
code
[ { "content": "Write a python function to find the length of the longest word.", "role": "user" } ]
["assert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7", "assert len_log([\"a\",\"ab\",\"abc\"]) == 3", "assert len_log([\"small\",\"big\",\"tall\"]) == 5"]
code
[ { "content": "Write a function to check if a substring is present in a given list of string values.", "role": "user" } ]
["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"]
code
[ { "content": "Write a function to check whether the given number is undulating or not.", "role": "user" } ]
["assert is_undulating(\"1212121\") == True", "assert is_undulating(\"1991\") == False", "assert is_undulating(\"121\") == True"]
code
[ { "content": "Write a function to calculate the value of 'a' to the power 'b'.", "role": "user" } ]
["assert power(3,4) == 81", "assert power(2,3) == 8", "assert power(5,5) == 3125"]
code
[ { "content": "Write a function to extract the index minimum value record from the given tuples.", "role": "user" } ]
["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'"]
code
[ { "content": "Write a python function to find the minimum length of sublist.", "role": "user" } ]
["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"]
code
[ { "content": "Write a python function to find the number of divisors of a given integer.", "role": "user" } ]
["assert divisor(15) == 4 ", "assert divisor(12) == 6", "assert divisor(9) == 3"]
code
[ { "content": "Write a function to find frequency count of list of lists.", "role": "user" } ]
["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}"]
code
[ { "content": "Write a function to multiply all the numbers in a list and divide with the length of the list.", "role": "user" } ]
["assert multiply_num((8, 2, 3, -1, 7))==-67.2", "assert multiply_num((-10,-20,-30))==-2000.0", "assert multiply_num((19,15,18))==1710.0"]
code
[ { "content": "Write a function to convert the given decimal number to its binary equivalent.", "role": "user" } ]
["assert decimal_to_binary(8) == '1000'", "assert decimal_to_binary(18) == '10010'", "assert decimal_to_binary(7) == '111' "]
code
[ { "content": "Write a function to find the next smallest palindrome of a specified number.", "role": "user" } ]
["assert next_smallest_palindrome(99)==101", "assert next_smallest_palindrome(1221)==1331", "assert next_smallest_palindrome(120)==121"]
code
[ { "content": "Write a function to find the kth element in the given array.", "role": "user" } ]
["assert kth_element([12,3,5,7,19], 5, 2) == 3", "assert kth_element([17,24,8,23], 4, 3) == 8", "assert kth_element([16,21,25,36,4], 5, 4) == 36"]
code
[ { "content": "Write a function to convert snake case string to camel case string.", "role": "user" } ]
["assert snake_to_camel('python_program')=='PythonProgram'", "assert snake_to_camel('python_language')==('PythonLanguage')", "assert snake_to_camel('programming_language')==('ProgrammingLanguage')"]
code
[ { "content": "Write a function to find eulerian number a(n, m).", "role": "user" } ]
["assert eulerian_num(3, 1) == 4", "assert eulerian_num(4, 1) == 11", "assert eulerian_num(5, 3) == 26"]
code
[ { "content": "Write a function to sort each sublist of strings in a given list of lists using lambda function.", "role": "user" } ]
["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']]"]
code
[ { "content": "Write a python function to count true booleans in the given list.", "role": "user" } ]
["assert count([True,False,True]) == 2", "assert count([False,False]) == 0", "assert count([True,True,True]) == 3"]
code
[ { "content": "Write a function to add the given list to the given tuples.", "role": "user" } ]
["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)"]
code
[ { "content": "Write a python function to count hexadecimal numbers for a given range.", "role": "user" } ]
["assert count_Hexadecimal(10,15) == 6", "assert count_Hexadecimal(2,4) == 0", "assert count_Hexadecimal(15,16) == 1"]
code
[ { "content": "Write a function to merge multiple sorted inputs into a single sorted iterator using heap queue algorithm.", "role": "user" } ]
["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]"]
code
[ { "content": "Write a python function to find the count of rotations of a binary string with odd value.", "role": "user" } ]
["assert odd_Equivalent(\"011001\",6) == 3", "assert odd_Equivalent(\"11011\",5) == 4", "assert odd_Equivalent(\"1010\",4) == 2"]
code
[ { "content": "Write a function to extract the ranges that are missing from the given list with the given start range and end range values.", "role": "user" } ]
["assert extract_missing([(6, 9), (15, 34), (48, 70)], 2, 100) == [(2, 6), (9, 100), (9, 15), (34, 100), (34, 48), (70, 100)]", "assert extract_missing([(7, 2), (15, 19), (38, 50)], 5, 60) == [(5, 7), (2, 60), (2, 15), (19, 60), (19, 38), (50, 60)]", "assert extract_missing([(7, 2), (15, 19), (38, 50)], 1, 52) == [(1, 7), (2, 52), (2, 15), (19, 52), (19, 38), (50, 52)]"]
code
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
3