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