prompt
stringlengths 42
252
| test_imports
sequencelengths 0
1
| test_list
sequencelengths 3
5
|
---|---|---|
Write a python function to check whether all the bits are unset in the given range or not. | [] | [
"assert all_Bits_Set_In_The_Given_Range(4,1,2) == True",
"assert all_Bits_Set_In_The_Given_Range(17,2,4) == True",
"assert all_Bits_Set_In_The_Given_Range(39,4,6) == False"
] |
Write a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved. | [] | [
"assert re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]",
"assert re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]",
"assert re_arrange_array([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85]"
] |
Write a function that takes in a string and character, replaces blank spaces in the string with the character, and returns the string. | [] | [
"assert replace_blank(\"hello people\",'@')==(\"hello@people\")",
"assert replace_blank(\"python program language\",'$')==(\"python$program$language\")",
"assert replace_blank(\"blank space\",\"-\")==(\"blank-space\")"
] |
Write a function that takes in a list and an integer n and returns a list containing the n largest items from the list. | [] | [
"assert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],2))==set([100,90])",
"assert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],5))==set([100,90,80,70,60])",
"assert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],3))==set([100,90,80])"
] |
Write a function to find the lateral surface area of a cylinder. | [
"import math"
] | [
"assert math.isclose(lateralsuface_cylinder(10,5), 314.15000000000003, rel_tol=0.001)",
"assert math.isclose(lateralsuface_cylinder(4,5), 125.66000000000001, rel_tol=0.001)",
"assert math.isclose(lateralsuface_cylinder(4,10), 251.32000000000002, rel_tol=0.001)"
] |
Write a function to find the volume of a cube given its side length. | [] | [
"assert volume_cube(3)==27",
"assert volume_cube(2)==8",
"assert volume_cube(5)==125"
] |
Write a python function to set all even bits of a given number. | [] | [
"assert even_bit_set_number(10) == 10",
"assert even_bit_set_number(20) == 30",
"assert even_bit_set_number(30) == 30"
] |
Write a function that takes in a list of tuples and returns a dictionary mapping each unique tuple to the number of times it occurs in the list. | [] | [
"assert check_occurences([(3, 1), (1, 3), (2, 5), (5, 2), (6, 3)] ) == {(1, 3): 2, (2, 5): 2, (3, 6): 1}",
"assert check_occurences([(4, 2), (2, 4), (3, 6), (6, 3), (7, 4)] ) == {(2, 4): 2, (3, 6): 2, (4, 7): 1}",
"assert check_occurences([(13, 2), (11, 23), (12, 25), (25, 12), (16, 23)] ) == {(2, 13): 1, (11, 23): 1, (12, 25): 2, (16, 23): 1}"
] |
Write a python function to count the number of non-empty substrings of a given string. | [] | [
"assert number_of_substrings(\"abc\") == 6",
"assert number_of_substrings(\"abcd\") == 10",
"assert number_of_substrings(\"abcde\") == 15"
] |
Write a function that takes in positive integers m and n and finds the number of possible sequences of length n, such that each element is a positive integer and is greater than or equal to twice the previous element but less than or equal to m. | [] | [
"assert get_total_number_of_sequences(10, 4) == 4",
"assert get_total_number_of_sequences(5, 2) == 6",
"assert get_total_number_of_sequences(16, 3) == 84"
] |
Write a function that takes in two lists and replaces the last element of the first list with the elements of the second list. | [] | [
"assert replace_list([1, 3, 5, 7, 9, 10],[2, 4, 6, 8])==[1, 3, 5, 7, 9, 2, 4, 6, 8]",
"assert replace_list([1,2,3,4,5],[5,6,7,8])==[1,2,3,4,5,6,7,8]",
"assert replace_list([\"red\",\"blue\",\"green\"],[\"yellow\"])==[\"red\",\"blue\",\"yellow\"]"
] |
Write a function to count the total number of characters in a string. | [] | [
"assert count_charac(\"python programming\")==18",
"assert count_charac(\"language\")==8",
"assert count_charac(\"words\")==5"
] |
Write a python function to find the next perfect square greater than a given number. | [] | [
"assert next_Perfect_Square(35) == 36",
"assert next_Perfect_Square(6) == 9",
"assert next_Perfect_Square(9) == 16"
] |
Write a function that takes an array and finds the maximum sum of a bitonic subsequence for the given array, where a sequence is bitonic if it is first increasing and then decreasing. | [] | [
"assert max_sum([1, 15, 51, 45, 33, 100, 12, 18, 9]) == 194",
"assert max_sum([80, 60, 30, 40, 20, 10]) == 210",
"assert max_sum([2, 3 ,14, 16, 21, 23, 29, 30]) == 138"
] |
Write a function for computing square roots using the babylonian method. | [
"import math"
] | [
"assert math.isclose(babylonian_squareroot(10), 3.162277660168379, rel_tol=0.001)",
"assert math.isclose(babylonian_squareroot(2), 1.414213562373095, rel_tol=0.001)",
"assert math.isclose(babylonian_squareroot(9), 3.0, rel_tol=0.001)"
] |
Write a function to find the length of the longest palindromic subsequence in the given string. | [] | [
"assert lps(\"TENS FOR TENS\") == 5",
"assert lps(\"CARDIO FOR CARDS\") == 7",
"assert lps(\"PART OF THE JOURNEY IS PART\") == 9"
] |
Write a function that takes in an integer n and calculates the harmonic sum of n-1. | [
"import math"
] | [
"assert math.isclose(harmonic_sum(7), 2.5928571428571425, rel_tol=0.001)",
"assert math.isclose(harmonic_sum(4), 2.083333333333333, rel_tol=0.001)",
"assert math.isclose(harmonic_sum(19), 3.547739657143682, rel_tol=0.001)"
] |
Write a function to find the intersection of two arrays. | [] | [
"assert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[1, 2, 4, 8, 9])==[1, 2, 8, 9]",
"assert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[3,5,7,9])==[3,5,7,9]",
"assert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[10,20,30,40])==[10]"
] |
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 that takes in a tuple and an element and counts the occcurences of the element in the tuple. | [] | [
"assert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),4) == 0",
"assert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),10) == 3",
"assert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),8) == 4"
] |
Write a function that takes in a list and an element and inserts the element before each element in the list, and returns the resulting list. | [] | [
"assert insert_element(['Red', 'Green', 'Black'] ,'c')==['c', 'Red', 'c', 'Green', 'c', 'Black']",
"assert insert_element(['python', 'java'] ,'program')==['program', 'python', 'program', 'java']",
"assert insert_element(['happy', 'sad'] ,'laugh')==['laugh', 'happy', 'laugh', 'sad']"
] |
Write a python function to convert complex numbers to polar coordinates. | [] | [
"assert convert(1) == (1.0, 0.0)",
"assert convert(4) == (4.0,0.0)",
"assert convert(5) == (5.0,0.0)"
] |
Write a python function that returns the number of integer elements in a given list. | [] | [
"assert count_integer([1,2,'abc',1.2]) == 2",
"assert count_integer([1,2,3]) == 3",
"assert count_integer([1,1.2,4,5.1]) == 2"
] |
Write a function that takes in a list and length n, and generates all combinations (with repetition) of the elements of the list and returns a list with a tuple for each combination. | [] | [
"assert combinations_colors( [\"Red\",\"Green\",\"Blue\"],1)==[('Red',), ('Green',), ('Blue',)]",
"assert combinations_colors( [\"Red\",\"Green\",\"Blue\"],2)==[('Red', 'Red'), ('Red', 'Green'), ('Red', 'Blue'), ('Green', 'Green'), ('Green', 'Blue'), ('Blue', 'Blue')]",
"assert combinations_colors( [\"Red\",\"Green\",\"Blue\"],3)==[('Red', 'Red', 'Red'), ('Red', 'Red', 'Green'), ('Red', 'Red', 'Blue'), ('Red', 'Green', 'Green'), ('Red', 'Green', 'Blue'), ('Red', 'Blue', 'Blue'), ('Green', 'Green', 'Green'), ('Green', 'Green', 'Blue'), ('Green', 'Blue', 'Blue'), ('Blue', 'Blue', 'Blue')]"
] |
Write a python function that takes in a non-negative number and returns the number of prime numbers less than the given non-negative number. | [] | [
"assert count_Primes_nums(5) == 2",
"assert count_Primes_nums(10) == 4",
"assert count_Primes_nums(100) == 25"
] |
Write a function that takes in two numbers and returns a tuple with the second number and then the first number. | [] | [
"assert swap_numbers(10,20)==(20,10)",
"assert swap_numbers(15,17)==(17,15)",
"assert swap_numbers(100,200)==(200,100)"
] |
Write a function to maximize the given two tuples. | [] | [
"assert maximize_elements(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((6, 7), (4, 9), (2, 9), (7, 10))",
"assert maximize_elements(((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))) == ((7, 8), (5, 10), (3, 10), (8, 11))",
"assert maximize_elements(((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))) == ((8, 9), (6, 11), (4, 11), (9, 12))"
] |
Write a function to find the nth newman–shanks–williams prime number. | [] | [
"assert newman_prime(3) == 7",
"assert newman_prime(4) == 17",
"assert newman_prime(5) == 41"
] |
Write a function that takes in two tuples and performs mathematical division operation element-wise across the given tuples. | [] | [
"assert division_elements((10, 4, 6, 9),(5, 2, 3, 3)) == (2, 2, 2, 3)",
"assert division_elements((12, 6, 8, 16),(6, 3, 4, 4)) == (2, 2, 2, 4)",
"assert division_elements((20, 14, 36, 18),(5, 7, 6, 9)) == (4, 2, 6, 2)"
] |
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. | [] | [
"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'])"
] |
Write a function to calculate a dog's age in dog's years. | [] | [
"assert dog_age(12)==61",
"assert dog_age(15)==73",
"assert dog_age(24)==109"
] |
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. | [] | [
"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']]"
] |
Write a function to find the lateral surface area of a cube given its side length. | [] | [
"assert lateralsurface_cube(5)==100",
"assert lateralsurface_cube(9)==324",
"assert lateralsurface_cube(10)==400"
] |
Write a python function that takes in an integer n and returns the sum of the squares of the first n odd natural numbers. | [] | [
"assert square_Sum(2) == 10",
"assert square_Sum(3) == 35",
"assert square_Sum(4) == 84"
] |
Write a function to find the n'th star number. | [] | [
"assert find_star_num(3) == 37",
"assert find_star_num(4) == 73",
"assert find_star_num(5) == 121"
] |
Write a function to find the ascii value of a character. | [] | [
"assert ascii_value('A')==65",
"assert ascii_value('R')==82",
"assert ascii_value('S')==83"
] |
Write a python function to find the sum of even numbers at even positions of a list. | [] | [
"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"
] |
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. | [] | [
"assert even_Power_Sum(2) == 1056",
"assert even_Power_Sum(3) == 8832",
"assert even_Power_Sum(1) == 32"
] |
Write a function that takes in a list of tuples and returns a list containing the rear element of each tuple. | [] | [
"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]"
] |
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. | [] | [
"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)"
] |
Write a python function that takes in a positive integer n and finds the sum of even index binomial coefficients. | [] | [
"assert even_binomial_Coeff_Sum(4) == 8",
"assert even_binomial_Coeff_Sum(6) == 32",
"assert even_binomial_Coeff_Sum(2) == 2"
] |
Write a function that takes in the radius and height of a cylinder and returns the the volume. | [
"import math"
] | [
"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)"
] |
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. | [] | [
"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}"
] |
Write a function to find the number of elements that occurs before the tuple element in the given tuple. | [] | [
"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"
] |
Write a function to find the nth decagonal number. | [] | [
"assert is_num_decagonal(3) == 27",
"assert is_num_decagonal(7) == 175",
"assert is_num_decagonal(10) == 370"
] |
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). | [] | [
"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)"
] |
Write a python function to check if the elements of a given list are unique or not. | [] | [
"assert all_unique([1,2,3]) == True",
"assert all_unique([1,2,1,2]) == False",
"assert all_unique([1,2,3,4,5]) == True"
] |
Write a function to subtract two lists element-wise. | [] | [
"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]"
] |
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. | [] | [
"assert validate(1234) == True",
"assert validate(51241) == False",
"assert validate(321) == True"
] |
Write a function that takes in a list and element and checks whether all items in the list are equal to the given element. | [] | [
"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"
] |
Write a function that checks whether a string contains the 'a' character followed by two or three 'b' characters. | [] | [
"assert text_match_two_three(\"ac\")==(False)",
"assert text_match_two_three(\"dc\")==(False)",
"assert text_match_two_three(\"abbbba\")==(True)"
] |
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. | [] | [
"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"
] |
Write a python function takes in an integer n and returns the sum of squares of first n even natural numbers. | [] | [
"assert square_Sum(2) == 20",
"assert square_Sum(3) == 56",
"assert square_Sum(4) == 120"
] |
Write a function to find the list of maximum length in a list of lists. | [] | [
"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])"
] |
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. | [] | [
"assert count_no_of_ways(2, 4) == 16",
"assert count_no_of_ways(3, 2) == 6",
"assert count_no_of_ways(4, 4) == 228"
] |
Write a python function to find quotient of two numbers (rounded down to the nearest integer). | [] | [
"assert find(10,3) == 3",
"assert find(4,2) == 2",
"assert find(20,5) == 4"
] |
Write a function to find the third side of a right angled triangle. | [] | [
"assert otherside_rightangle(7,8)==10.63014581273465",
"assert otherside_rightangle(3,4)==5",
"assert otherside_rightangle(7,15)==16.55294535724685"
] |
Write a function to find the maximum value in a given heterogeneous list. | [] | [
"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"
] |
Write a function to return the sum of all divisors of a number. | [] | [
"assert sum_div(8)==7",
"assert sum_div(12)==16",
"assert sum_div(7)==1"
] |
Write a python function to count inversions in an array. | [] | [
"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"
] |
Write a function to flatten a given nested list structure. | [] | [
"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]"
] |
Write a function to calculate the maximum aggregate from the list of tuples. | [] | [
"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)"
] |
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. | [
"import math"
] | [
"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)"
] |
Write a function to find the depth of a dictionary. | [] | [
"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"
] |
Write a python function to find element at a given index after number of rotations. | [] | [
"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"
] |
Write a function to return two words from a list of words starting with letter 'p'. | [] | [
"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')"
] |
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 . | [] | [
"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"
] |
Write a function to get a colon of a tuple. | [] | [
"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)"
] |
Write a function to find the specified number of largest products from two given lists, selecting one factor from each list. | [] | [
"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]"
] |
Write a python function to find the maximum of two numbers. | [] | [
"assert maximum(5,10) == 10",
"assert maximum(-1,-2) == -1",
"assert maximum(9,7) == 9"
] |
Write a function to convert a given string to a tuple of characters. | [] | [
"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')"
] |
Write a python function to set the left most unset bit. | [] | [
"assert set_left_most_unset_bit(10) == 14",
"assert set_left_most_unset_bit(12) == 14",
"assert set_left_most_unset_bit(15) == 15"
] |
Write a function to find the volume of a cone. | [
"import math"
] | [
"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)"
] |
Write a python function to find the highest power of 2 that is less than or equal to n. | [] | [
"assert highest_Power_of_2(10) == 8",
"assert highest_Power_of_2(19) == 16",
"assert highest_Power_of_2(32) == 32"
] |
Write a function to find the n'th lucas number. | [] | [
"assert find_lucas(9) == 76",
"assert find_lucas(4) == 7",
"assert find_lucas(3) == 4"
] |
Write a function to apply a given format string to all of the elements in a list. | [] | [
"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']"
] |
Write a function to convert more than one list to nested dictionary. | [] | [
"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}}]"
] |
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). | [] | [
"assert get_max_sum(60) == 106",
"assert get_max_sum(10) == 12",
"assert get_max_sum(2) == 2"
] |
Write a function to find the list with maximum length. | [] | [
"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])"
] |
Write a function to check if given tuple contains no duplicates. | [] | [
"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"
] |
Write a python function to find the first non-repeated character in a given string. | [] | [
"assert first_non_repeating_character(\"abcabc\") == None",
"assert first_non_repeating_character(\"abc\") == \"a\"",
"assert first_non_repeating_character(\"ababc\") == \"c\""
] |
Write a function to check whether the given string starts and ends with the same character or not. | [] | [
"assert check_char(\"abba\") == \"Valid\"",
"assert check_char(\"a\") == \"Valid\"",
"assert check_char(\"abcd\") == \"Invalid\""
] |
Write a function to find the median of three numbers. | [] | [
"assert median_numbers(25,55,65)==55.0",
"assert median_numbers(20,10,30)==20.0",
"assert median_numbers(15,45,75)==45.0"
] |
Write a function to compute the sum of digits of each number of a given list. | [] | [
"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"
] |
Write a function to perform the mathematical bitwise xor operation across the given tuples. | [] | [
"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)"
] |
Write a function to extract the number of unique tuples in the given list. | [] | [
"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"
] |
Write a function to perform index wise addition of tuple elements in the given two nested tuples. | [] | [
"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))"
] |
Write a function to convert the given snake case string to camel case string. | [] | [
"assert snake_to_camel('android_tv') == 'AndroidTv'",
"assert snake_to_camel('google_pixel') == 'GooglePixel'",
"assert snake_to_camel('apple_watch') == 'AppleWatch'"
] |
Write a function to find the directrix of a parabola. | [] | [
"assert parabola_directrix(5,3,2)==-198",
"assert parabola_directrix(9,8,4)==-2336",
"assert parabola_directrix(2,4,6)==-130"
] |
Write a function that takes two lists and returns true if they have at least one common element. | [] | [
"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"
] |
Write a function to check whether the entered number is greater than the elements of the given array. | [] | [
"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"
] |
Write a function to count bidirectional tuple pairs. | [] | [
"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"
] |
Write a function to find the first adverb and their positions in a given sentence. | [] | [
"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')"
] |
Write a function to trim each tuple by k in the given tuple list. | [] | [
"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)]'"
] |
Write a function to calculate the sum of perrin numbers. | [] | [
"assert cal_sum(9) == 49",
"assert cal_sum(10) == 66",
"assert cal_sum(11) == 88"
] |
Write a function to extract specified size of strings from a given list of string values. | [] | [
"assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,8)==['practice', 'solution']",
"assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,6)==['Python']",
"assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,9)==['exercises']"
] |
Write a function that gives loss amount on a sale if the given amount has loss else return 0. | [] | [
"assert loss_amount(1500,1200)==0",
"assert loss_amount(100,200)==100",
"assert loss_amount(2000,5000)==3000"
] |
Write a python function to count the upper case characters in a given string. | [] | [
"assert upper_ctr('PYthon') == 1",
"assert upper_ctr('BigData') == 1",
"assert upper_ctr('program') == 0"
] |
Write a function to find all possible combinations of the elements of a given list. | [] | [
"assert combinations_list(['orange', 'red', 'green', 'blue'])==[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]",
"assert combinations_list(['red', 'green', 'blue', 'white', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]",
"assert combinations_list(['red', 'green', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]"
] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. | [] | [
"assert max_product([3, 100, 4, 5, 150, 6]) == 3000",
"assert max_product([4, 42, 55, 68, 80]) == 50265600",
"assert max_product([10, 22, 9, 33, 21, 50, 41, 60]) == 2460"
] |