Dataset Viewer
Auto-converted to Parquet Duplicate
task_id
int64
601
974
text
large_stringlengths
38
249
code
large_stringlengths
30
908
test_list
listlengths
3
3
test_setup_code
large_stringclasses
2 values
challenge_test_list
listlengths
0
0
738
Write a function to find common index elements from three lists.
def find_triplet_array(A, arr_size, sum): for i in range( 0, arr_size-2): for j in range(i + 1, arr_size-1): for k in range(j + 1, arr_size): if A[i] + A[j] + A[k] == sum: return A[i],A[j],A[k] return True return False
[ "assert product_Equal(2841) == True", "assert product_Equal(1234) == False", "assert product_Equal(1212) == False" ]
[]
965
Write a function to count number of lists in a given list of lists and square the count.
def Odd_Length_Sum(arr): Sum = 0 l = len(arr) for i in range(l): Sum += ((((i + 1) *(l - i) + 1) // 2) * arr[i]) return Sum
[ "assert check_subset([[1, 3], [5, 7], [9, 11], [13, 15, 17]] ,[[1, 3],[13,15,17]])==True", "assert check_subset([[1, 2], [2, 3], [3, 4], [5, 6]],[[3, 4], [5, 6]])==True", "assert check_subset([[[1, 2], [2, 3]], [[3, 4], [5, 7]]],[[[3, 4], [5, 6]]])==False" ]
[]
646
Write a function to sort a list in a dictionary.
def ntimes_list(nums,n): result = map(lambda x:n*x, nums) return list(result)
[ "assert find_Sum([1,2,3,1,1,4,5,6],8) == 21", "assert find_Sum([1,10,9,4,2,10,10,45,4],9) == 71", "assert find_Sum([12,10,9,45,2,10,10,45,10],9) == 78" ]
[]
828
Write a function to sort the given array by using heap sort.
def is_upper(string): return (string.upper())
[ "assert anagram_lambda([\"bcda\", \"abce\", \"cbda\", \"cbea\", \"adcb\"],\"abcd\")==['bcda', 'cbda', 'adcb']", "assert anagram_lambda([\"recitals\",\" python\"], \"articles\" )==[\"recitals\"]", "assert anagram_lambda([\" keep\",\" abcdef\",\" xyz\"],\" peek\")==[\" keep\"]" ]
[]
729
Write a function to validate a gregorian date.
import re text = 'Python Exercises' def replace_spaces(text): text =text.replace (" ", "_") return (text) text =text.replace ("_", " ") return (text)
[ "assert remove_parenthesis([\"python (chrome)\"])==(\"python\")", "assert remove_parenthesis([\"string(.abc)\"])==(\"string\")", "assert remove_parenthesis([\"alpha(num)\"])==(\"alpha\")" ]
[]
848
Write a function to multiply the adjacent elements of the given tuple.
def mutiple_tuple(nums): temp = list(nums) product = 1 for x in temp: product *= x return product
[ "assert profit_amount(1500,1200)==300", "assert profit_amount(100,200)==None", "assert profit_amount(2000,5000)==None" ]
[]
905
Write a function to sum the length of the names of a given list of names after removing the names that start with a lowercase letter.
def check(string): if len(set(string).intersection("AEIOUaeiou"))>=5: return ('accepted') else: return ("not accepted")
[ "assert is_Perfect_Square(10) == False", "assert is_Perfect_Square(36) == True", "assert is_Perfect_Square(14) == False" ]
[]
605
Write a function to compute maximum product of three numbers of a given array of integers using heap queue algorithm.
import re def remove_multiple_spaces(text1): return (re.sub(' +',' ',text1))
[ "assert sort_String(\"cba\") == \"abc\"", "assert sort_String(\"data\") == \"aadt\"", "assert sort_String(\"zxy\") == \"xyz\"" ]
[]
652
Write a function to return true if the given number is even else return false.
import re def occurance_substring(text,pattern): for match in re.finditer(pattern, text): s = match.start() e = match.end() return (text[s:e], s, e)
[ "assert substract_elements(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((-5, -4), (1, -4), (1, 8), (-6, 7))", "assert substract_elements(((13, 4), (14, 6), (13, 10), (12, 11)), ((19, 8), (14, 10), (12, 2), (18, 4))) == ((-6, -4), (0, -4), (1, 8), (-6, 7))", "assert substract_elements...
[]
837
Write a python function to count lower case letters in a given string.
def cummulative_sum(test_list): res = sum(map(sum, test_list)) return (res)
[ "assert extract_index_list([1, 1, 3, 4, 5, 6, 7],[0, 1, 2, 3, 4, 5, 7],[0, 1, 2, 3, 4, 5, 7])==[1, 7]", "assert extract_index_list([1, 1, 3, 4, 5, 6, 7],[0, 1, 2, 3, 4, 6, 5],[0, 1, 2, 3, 4, 6, 7])==[1, 6]", "assert extract_index_list([1, 1, 3, 4, 6, 5, 6],[0, 1, 2, 3, 4, 5, 7],[0, 1, 2, 3, 4, 5, 7])==[1, 5]" ]
[]
919
Write a python function to accept the strings which contains all vowels.
def remove_duplic_list(l): temp = [] for x in l: if x not in temp: temp.append(x) return temp
[ "assert count_same_pair([1, 2, 3, 4, 5, 6, 7, 8],[2, 2, 3, 1, 2, 6, 7, 9])==4", "assert count_same_pair([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8],[2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==11", "assert count_same_pair([2, 4, -6, -9, 11, -12, 14, -5, 17],[2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==1" ]
[]
651
Write a function to caluclate arc length of an angle.
from collections import Counter def add_dict(d1,d2): add_dict = Counter(d1) + Counter(d2) return add_dict
[ "assert get_key({1:'python',2:'java'})==[1,2]", "assert get_key({10:'red',20:'blue',30:'black'})==[10,20,30]", "assert get_key({27:'language',39:'java',44:'little'})==[27,39,44]" ]
[]
962
Write a python function to find the last position of an element in a sorted array.
import re def change_date_format(dt): return re.sub(r'(\d{4})-(\d{1,2})-(\d{1,2})', '\\3-\\2-\\1', dt) return change_date_format(dt)
[ "assert join_tuples([(5, 6), (5, 7), (6, 8), (6, 10), (7, 13)] ) == [(5, 6, 7), (6, 8, 10), (7, 13)]", "assert join_tuples([(6, 7), (6, 8), (7, 9), (7, 11), (8, 14)] ) == [(6, 7, 8), (7, 9, 11), (8, 14)]", "assert join_tuples([(7, 8), (7, 9), (8, 10), (8, 12), (9, 15)] ) == [(7, 8, 9), (8, 10, 12), (9, 15)]" ]
[]
761
Write a function to increment the numeric values in the given strings by k.
def coin_change(S, m, n): table = [[0 for x in range(m)] for x in range(n+1)] for i in range(m): table[0][i] = 1 for i in range(1, n+1): for j in range(m): x = table[i - S[j]][j] if i-S[j] >= 0 else 0 y = table[i][j-1] if j >= 1 else 0 table[...
[ "assert check_none((10, 4, 5, 6, None)) == True", "assert check_none((7, 8, 9, 11, 14)) == False", "assert check_none((1, 2, 3, 4, None)) == True" ]
[]
648
Write a function to find the nth super ugly number from a given prime list of size k using heap queue algorithm.
def check(arr,n): g = 0 for i in range(1,n): if (arr[i] - arr[i - 1] > 0 and g == 1): return False if (arr[i] - arr[i] < 0): g = 1 return True
[ "assert unique_sublists([[1, 3], [5, 7], [1, 3], [13, 15, 17], [5, 7], [9, 11]])=={(1, 3): 2, (5, 7): 2, (13, 15, 17): 1, (9, 11): 1}", "assert unique_sublists([['green', 'orange'], ['black'], ['green', 'orange'], ['white']])=={('green', 'orange'): 2, ('black',): 1, ('white',): 1}", "assert unique_sublists([[1,...
[]
903
Write a function to reverse words in a given string.
import re regex = '[a-zA-z0-9]$' def check_alphanumeric(string): if(re.search(regex, string)): return ("Accept") else: return ("Discard")
[ "assert int_to_roman(1)==(\"I\")", "assert int_to_roman(50)==(\"L\")", "assert int_to_roman(4)==(\"IV\")" ]
[]
868
Write a function to convert tuple string to integer tuple.
def check_monthnumb(monthname2): if(monthname2=="January" or monthname2=="March"or monthname2=="May" or monthname2=="July" or monthname2=="Augest" or monthname2=="October" or monthname2=="December"): return True else: return False
[ "assert (max_height(root)) == 3", "assert (max_height(root1)) == 5 ", "assert (max_height(root2)) == 4" ]
[]
931
Write a function to find length of the string.
def count_range_in_list(li, min, max): ctr = 0 for x in li: if min <= x <= max: ctr += 1 return ctr
[ "assert tuple_modulo((10, 4, 5, 6), (5, 6, 7, 5)) == (0, 4, 5, 1)", "assert tuple_modulo((11, 5, 6, 7), (6, 7, 8, 6)) == (5, 5, 6, 1)", "assert tuple_modulo((12, 6, 7, 8), (7, 8, 9, 7)) == (5, 6, 7, 1)" ]
[]
942
Write a python function to check whether the given number is a perfect square or not.
def sum_Square(n) : i = 1 while i*i <= n : j = 1 while (j*j <= n) : if (i*i+j*j == n) : return True j = j+1 i = i+1 return False
[ "assert check_K((10, 4, 5, 6, 8), 6) == True", "assert check_K((1, 2, 3, 4, 5, 6), 7) == False", "assert check_K((7, 8, 9, 44, 11, 12), 11) == True" ]
[]
713
Write a python function to reverse an array upto a given position.
def min_Swaps(str1,str2) : count = 0 for i in range(len(str1)) : if str1[i] != str2[i] : count += 1 if count % 2 == 0 : return (count // 2) else : return ("Not Possible")
[ "assert get_median([1, 12, 15, 26, 38], [2, 13, 17, 30, 45], 5) == 16.0", "assert get_median([2, 4, 8, 9], [7, 13, 19, 28], 4) == 8.5", "assert get_median([3, 6, 14, 23, 36, 42], [2, 18, 27, 39, 49, 55], 6) == 25.0" ]
[]
916
Write a python function to access multiple elements of specified index from a given list.
import re def pass_validity(p): x = True while x: if (len(p)<6 or len(p)>12): break elif not re.search("[a-z]",p): break elif not re.search("[0-9]",p): break elif not re.search("[A-Z]",p): break elif not re.search("[$#@]",p): break elif r...
[ "assert super_seq(\"AGGTAB\", \"GXTXAYB\", 6, 7) == 9", "assert super_seq(\"feek\", \"eke\", 4, 3) == 5", "assert super_seq(\"PARRT\", \"RTA\", 5, 3) == 6" ]
[]
934
Write a function to replace whitespaces with an underscore and vice versa in a given string by using regex.
def series_sum(number): total = 0 total = (number * (number + 1) * (2 * number + 1)) / 6 return total
[ "assert min_k([('Manjeet', 10), ('Akshat', 4), ('Akash', 2), ('Nikhil', 8)], 2) == [('Akash', 2), ('Akshat', 4)]", "assert min_k([('Sanjeev', 11), ('Angat', 5), ('Akash', 3), ('Nepin', 9)], 3) == [('Akash', 3), ('Angat', 5), ('Nepin', 9)]", "assert min_k([('tanmay', 14), ('Amer', 11), ('Ayesha', 9), ('SKD', 16)...
[]
634
Write a function to divide two lists using map and lambda function.
def is_subset(arr1, m, arr2, n): hashset = set() for i in range(0, m): hashset.add(arr1[i]) for i in range(0, n): if arr2[i] in hashset: continue else: return False return True
[ "assert text_uppercase_lowercase(\"AaBbGg\")==('Found a match!')", "assert text_uppercase_lowercase(\"aA\")==('Not matched!')", "assert text_uppercase_lowercase(\"PYTHON\")==('Not matched!')" ]
[]
859
Write a function to remove all whitespaces from a string.
def concatenate_nested(test_tup1, test_tup2): res = test_tup1 + test_tup2 return (res)
[ "assert Average([15, 9, 55, 41, 35, 20, 62, 49]) == 35.75", "assert Average([4, 5, 1, 2, 9, 7, 10, 8]) == 5.75", "assert Average([1,2,3]) == 2" ]
[]
614
Write a function to check whether the given string is starting with a vowel or not using regex.
def Repeat(x): _size = len(x) repeated = [] for i in range(_size): k = i + 1 for j in range(k, _size): if x[i] == x[j] and x[i] not in repeated: repeated.append(x[i]) return repeated
[ "assert even_position([3,2,1]) == False", "assert even_position([1,2,3]) == False", "assert even_position([2,1,4]) == True" ]
[]
645
Write a function to check if the given tuple has any none value or not.
def sort_numeric_strings(nums_str): result = [int(x) for x in nums_str] result.sort() return result
[ "assert odd_position([2,1,4,3,6,7,6,3]) == True", "assert odd_position([4,1,2]) == True", "assert odd_position([1,2,3]) == False" ]
[]
842
Write a function to remove all characters except letters and numbers using regex
def max_of_two( x, y ): if x > y: return x return y
[ "assert max_sum_of_three_consecutive([100, 1000, 100, 1000, 1], 5) == 2101", "assert max_sum_of_three_consecutive([3000, 2000, 1000, 3, 10], 5) == 5013", "assert max_sum_of_three_consecutive([1, 2, 3, 4, 5, 6, 7, 8], 8) == 27" ]
[]
637
Write a python function to check whether the given two arrays are equal or not.
def remove_negs(num_list): for item in num_list: if item < 0: num_list.remove(item) return num_list
[ "assert are_Equal([1,2,3],[3,2,1],3,3) == True", "assert are_Equal([1,1,1],[2,2,2],3,3) == False", "assert are_Equal([8,9],[4,5,6],2,3) == False" ]
[]
612
Write a function to access the initial and last data of the given tuple record.
def noprofit_noloss(actual_cost,sale_amount): if(sale_amount == actual_cost): return True else: return False
[ "assert max_product([1, 2, 3, 4, 7, 0, 8, 4])==(7, 8)", "assert max_product([0, -1, -2, -4, 5, 0, -6])==(-4, -6)", "assert max_product([1, 3, 5, 6, 8, 9])==(8,9)" ]
[]
955
Write a function to find length of the subarray having maximum sum.
def check_valid(test_tup): res = not any(map(lambda ele: not ele, test_tup)) return (res)
[ "assert mul_consecutive_nums([1, 1, 3, 4, 4, 5, 6, 7])==[1, 3, 12, 16, 20, 30, 42]", "assert mul_consecutive_nums([4, 5, 8, 9, 6, 10])==[20, 40, 72, 54, 60]", "assert mul_consecutive_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[2, 6, 12, 20, 30, 42, 56, 72, 90]" ]
[]
812
Write a function to find the median of two sorted arrays of same size.
def min_sum_path(A): memo = [None] * len(A) n = len(A) - 1 for i in range(len(A[n])): memo[i] = A[n][i] for i in range(len(A) - 2, -1,-1): for j in range( len(A[i])): memo[j] = A[i][j] + min(memo[j], memo[j + 1]) return memo[0]
[ "assert sum_Of_Primes(10) == 17", "assert sum_Of_Primes(20) == 77", "assert sum_Of_Primes(5) == 10" ]
[]
899
Write a function to count the frequency of consecutive duplicate elements in a given list of numbers.
def sort_dict_item(test_dict): res = {key: test_dict[key] for key in sorted(test_dict.keys(), key = lambda ele: ele[1] * ele[0])} return (res)
[ "assert Sum_of_Inverse_Divisors(6,12) == 2", "assert Sum_of_Inverse_Divisors(9,13) == 1.44", "assert Sum_of_Inverse_Divisors(1,4) == 4" ]
[]
806
Write a function to calculate the sum of series 1²+2²+3²+….+n².
def remove_even(l): for i in l: if i % 2 == 0: l.remove(i) return l
[ "assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},5)==True", "assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},6)==True", "assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},10)==False" ]
[]
773
Write a function to split the given string at uppercase letters by using regex.
def get_Pairs_Count(arr,n,sum): count = 0 for i in range(0,n): for j in range(i + 1,n): if arr[i] + arr[j] == sum: count += 1 return count
[ "assert extract_unique({'msm' : [5, 6, 7, 8],'is' : [10, 11, 7, 5],'best' : [6, 12, 10, 8],'for' : [1, 2, 5]} ) == [1, 2, 5, 6, 7, 8, 10, 11, 12]", "assert extract_unique({'Built' : [7, 1, 9, 4],'for' : [11, 21, 36, 14, 9],'ISP' : [4, 1, 21, 39, 47],'TV' : [1, 32, 38]} ) == [1, 4, 7, 9, 11, 14, 21, 32, 36, 38, 39...
[]
945
Write a function to filter the height and width of students which are stored in a dictionary.
def palindrome_lambda(texts): result = list(filter(lambda x: (x == "".join(reversed(x))), texts)) return result
[ "assert largest_subset([ 1, 3, 6, 13, 17, 18 ], 6) == 4", "assert largest_subset([10, 5, 3, 15, 20], 5) == 3", "assert largest_subset([18, 1, 3, 6, 13, 17], 6) == 4" ]
[]
669
Write a python function to count the number of digits in factorial of a given number.
def multiply_list(items): tot = 1 for x in items: tot *= x return tot
[ "assert is_upper(\"person\") ==\"PERSON\"", "assert is_upper(\"final\") == \"FINAL\"", "assert is_upper(\"Valid\") == \"VALID\"" ]
[]
602
Write a python function to find the minimum sum of absolute differences of two arrays.
def Sum(N): SumOfPrimeDivisors = [0]*(N + 1) for i in range(2,N + 1) : if (SumOfPrimeDivisors[i] == 0) : for j in range(i,N + 1,i) : SumOfPrimeDivisors[j] += i return SumOfPrimeDivisors[N]
[ "assert is_decimal('123.11')==True", "assert is_decimal('e666.86')==False", "assert is_decimal('3.124587')==False" ]
[]
671
Write a python function to find minimum possible value for the given periodic function.
from collections import Counter def anagram_lambda(texts,str): result = list(filter(lambda x: (Counter(str) == Counter(x)), texts)) return result
[ "assert exchange_elements([0,1,2,3,4,5])==[1, 0, 3, 2, 5, 4] ", "assert exchange_elements([5,6,7,8,9,10])==[6,5,8,7,10,9] ", "assert exchange_elements([25,35,45,55,75,95])==[35,25,55,45,95,75] " ]
[]
959
Write a python function to find the minimum number of swaps required to convert one binary string to another.
import heapq as hq def heap_sort(iterable): h = [] for value in iterable: hq.heappush(h, value) return [hq.heappop(h) for i in range(len(h))]
[ "assert generate_matrix(3)==[[1, 2, 3], [8, 9, 4], [7, 6, 5]] ", "assert generate_matrix(2)==[[1,2],[4,3]]", "assert generate_matrix(7)==[[1, 2, 3, 4, 5, 6, 7], [24, 25, 26, 27, 28, 29, 8], [23, 40, 41, 42, 43, 30, 9], [22, 39, 48, 49, 44, 31, 10], [21, 38, 47, 46, 45, 32, 11], [20, 37, 36, 35, 34, 33, 12], [19...
[]
879
Write a function to separate and print the numbers and their position of a given string.
def max_sum_subseq(A): n = len(A) if n == 1: return A[0] look_up = [None] * n look_up[0] = A[0] look_up[1] = max(A[0], A[1]) for i in range(2, n): look_up[i] = max(look_up[i - 1], look_up[i - 2] + A[i]) look_up[i] = max(look_up[i], A[i]) return look_up[n - 1...
[ "assert smallest_Divisor(10) == 2", "assert smallest_Divisor(25) == 5", "assert smallest_Divisor(31) == 31" ]
[]
906
Write a function to find maximum run of uppercase characters in the given string.
def remove_length(test_str, K): temp = test_str.split() res = [ele for ele in temp if len(ele) != K] res = ' '.join(res) return (res)
[ "assert reverse_Array_Upto_K([1, 2, 3, 4, 5, 6],4) == [4, 3, 2, 1, 5, 6]", "assert reverse_Array_Upto_K([4, 5, 6, 7], 2) == [5, 4, 6, 7]", "assert reverse_Array_Upto_K([9, 8, 7, 6, 5],3) == [7, 8, 9, 6, 5]" ]
[]
683
Write a python function to count numeric values in a given string.
import re def remove_char(S): result = re.sub('[\W_]+', '', S) return result
[ "assert Odd_Length_Sum([1,2,4]) == 14", "assert Odd_Length_Sum([1,2,1,2]) == 15", "assert Odd_Length_Sum([1,7]) == 8" ]
[]
827
Write a function to add two lists using map and lambda function.
def convert(list): s = [str(i) for i in list] res = int("".join(s)) return (res)
[ "assert lcopy([1, 2, 3]) == [1, 2, 3]", "assert lcopy([4, 8, 2, 10, 15, 18]) == [4, 8, 2, 10, 15, 18]", "assert lcopy([4, 5, 6]) == [4, 5, 6]\n" ]
[]
862
Write a function to convert the given string of float type into tuple.
def max_product(arr): arr_len = len(arr) if (arr_len < 2): return None x = arr[0]; y = arr[1] for i in range(0, arr_len): for j in range(i + 1, arr_len): if (arr[i] * arr[j] > x * y): x = arr[i]; y = arr[j] return x,y
[ "assert maxAverageOfPath([[1, 2, 3], [6, 5, 4], [7, 3, 9]], 3) == 5.2", "assert maxAverageOfPath([[2, 3, 4], [7, 6, 5], [8, 4, 10]], 3) == 6.2", "assert maxAverageOfPath([[3, 4, 5], [8, 7, 6], [9, 5, 11]], 3) == 7.2 " ]
[]
670
Write a function to count the most common character in a given string.
def count_even(array_nums): count_even = len(list(filter(lambda x: (x%2 == 0) , array_nums))) return count_even
[ "assert sum_even_odd([1,3,5,7,4,1,6,8])==5", "assert sum_even_odd([1,2,3,4,5,6,7,8,9,10])==3", "assert sum_even_odd([1,5,7,9,10])==11" ]
[]
754
Write a function to check if a triangle of positive area is possible with the given angles.
def binomial_coeff(n, k): C = [[0 for j in range(k + 1)] for i in range(n + 1)] for i in range(0, n + 1): for j in range(0, min(i, k) + 1): if (j == 0 or j == i): C[i][j] = 1 else: C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) return C[n][k] def lobb_num(n, m): return ((...
[ "assert access_key({'physics': 80, 'math': 90, 'chemistry': 86},0)== 'physics'", "assert access_key({'python':10, 'java': 20, 'C++':30},2)== 'C++'", "assert access_key({'program':15,'computer':45},1)== 'computer'" ]
[]
786
Write a function that matches a string that has an 'a' followed by anything, ending in 'b' by using regex.
def bell_Number(n): bell = [[0 for i in range(n+1)] for j in range(n+1)] bell[0][0] = 1 for i in range(1, n+1): bell[i][0] = bell[i-1][i-1] for j in range(1, i+1): bell[i][j] = bell[i-1][j-1] + bell[i][j-1] return bell[n][0]
[ "assert decreasing_trend([-4,-3,-2,-1]) == True", "assert decreasing_trend([1,2,3]) == True", "assert decreasing_trend([3,2,1]) == False" ]
[]
616
Write a function to caluclate the area of a tetrahedron.
M = 100 def maxAverageOfPath(cost, N): dp = [[0 for i in range(N + 1)] for j in range(N + 1)] dp[0][0] = cost[0][0] for i in range(1, N): dp[i][0] = dp[i - 1][0] + cost[i][0] for j in range(1, N): dp[0][j] = dp[0][j - 1] + cost[0][j] for i in range(1, N): for j in range(1, N): dp[i][j] ...
[ "assert palindrome_lambda([\"php\", \"res\", \"Python\", \"abcd\", \"Java\", \"aaa\"])==['php', 'aaa']", "assert palindrome_lambda([\"abcd\", \"Python\", \"abba\", \"aba\"])==['abba', 'aba']", "assert palindrome_lambda([\"abcd\", \"abbccbba\", \"abba\", \"aba\"])==['abbccbba', 'abba', 'aba']" ]
[]
893
Write a python function to check for odd parity of a given number.
def min_k(test_list, K): res = sorted(test_list, key = lambda x: x[1])[:K] return (res)
[ "assert find_First_Missing([0,1,2,3],0,3) == 4", "assert find_First_Missing([0,1,2,6,9],0,4) == 3", "assert find_First_Missing([2,3,5,8,9],0,4) == 0" ]
[]
675
Write a python function to check whether the word is present in a given sentence or not.
def join_tuples(test_list): res = [] for sub in test_list: if res and res[-1][0] == sub[0]: res[-1].extend(sub[1:]) else: res.append([ele for ele in sub]) res = list(map(tuple, res)) return (res)
[ "assert combine_lists([1, 3, 5, 7, 9, 11],[0, 2, 4, 6, 8, 10])==[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]", "assert combine_lists([1, 3, 5, 6, 8, 9], [2, 5, 7, 11])==[1,2,3,5,5,6,7,8,9,11]", "assert combine_lists([1,3,7],[2,4,6])==[1,2,3,4,6,7]" ]
[]
870
Write a function to add the given tuple to the given list.
def move_num(test_str): res = '' dig = '' for ele in test_str: if ele.isdigit(): dig += ele else: res += ele res += dig return (res)
[ "assert text_match(\"aabbbbd\") == 'Not matched!'", "assert text_match(\"aabAbbbc\") == 'Not matched!'", "assert text_match(\"accddbbjjjb\") == 'Found a match!'" ]
[]
801
Write a function to find numbers divisible by m or n from a list of numbers using lambda function.
def count_list(input_list): return len(input_list)
[ "assert text_match_wordz_middle(\"pythonzabc.\")==('Found a match!')", "assert text_match_wordz_middle(\"xyzabc.\")==('Found a match!')", "assert text_match_wordz_middle(\" lang .\")==('Not matched!')" ]
[]
830
Write a python function to find the sum of fourth power of first n odd natural numbers.
def floor_Max(A,B,N): x = min(B - 1,N) return (A*x) // B
[ "assert cummulative_sum([(1, 3), (5, 6, 7), (2, 6)]) == 30", "assert cummulative_sum([(2, 4), (6, 7, 8), (3, 7)]) == 37", "assert cummulative_sum([(3, 5), (7, 8, 9), (4, 8)]) == 44" ]
[]
718
Write a function to find the length of the shortest string that has both str1 and str2 as subsequences.
def sum_column(list1, C): result = sum(row[C] for row in list1) return result
[ "assert jacobsthal_num(5) == 11", "assert jacobsthal_num(2) == 1", "assert jacobsthal_num(4) == 5" ]
[]
607
Write a function to check if each element of the second tuple is greater than its corresponding index in the first tuple.
def reverse_words(s): return ' '.join(reversed(s.split()))
[ "assert replace_spaces(\"My Name is Dawood\") == 'My%20Name%20is%20Dawood'", "assert replace_spaces(\"I am a Programmer\") == 'I%20am%20a%20Programmer'", "assert replace_spaces(\"I love Coding\") == 'I%20love%20Coding'" ]
[]
622
Write a function to count repeated items of a tuple.
def lcopy(xs): return xs[:]
[ "assert sum_nums(2,10,11,20)==20", "assert sum_nums(15,17,1,10)==32", "assert sum_nums(10,15,5,30)==20" ]
[]
790
Write a python function to convert a list of multiple integers into a single integer.
def lower_ctr(str): lower_ctr= 0 for i in range(len(str)): if str[i] >= 'a' and str[i] <= 'z': lower_ctr += 1 return lower_ctr
[ "assert check_valid((True, True, True, True) ) == True", "assert check_valid((True, False, True, True) ) == False", "assert check_valid((True, True, True, True) ) == True" ]
[]
970
Write a function to get the length of a complex number.
def find_first_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid right = mid - 1 elif x < A[mid]: right = mid - 1 else: left = mi...
[ "assert right_insertion([1,2,4,5],6)==4", "assert right_insertion([1,2,4,5],3)==2", "assert right_insertion([1,2,4,5],7)==4" ]
[]
611
Write a function to reverse each list in a given list of lists.
def get_ludic(n): ludics = [] for i in range(1, n + 1): ludics.append(i) index = 1 while(index != len(ludics)): first_ludic = ludics[index] remove_index = index + first_ludic while(remove_index < len(ludics)): ludics.remove(ludics[remove_index]) remove_index = remove_index + first_ludic - 1 ...
[ "assert reverse_words(\"python program\")==(\"program python\")", "assert reverse_words(\"java language\")==(\"language java\")", "assert reverse_words(\"indian man\")==(\"man indian\")" ]
[]
730
Write a python function to find even numbers from a mixed list.
def front_and_rear(test_tup): res = (test_tup[0], test_tup[-1]) return (res)
[ "assert maximum_value([('key1', [3, 4, 5]), ('key2', [1, 4, 2]), ('key3', [9, 3])]) == [('key1', 5), ('key2', 4), ('key3', 9)]", "assert maximum_value([('key1', [4, 5, 6]), ('key2', [2, 5, 3]), ('key3', [10, 4])]) == [('key1', 6), ('key2', 5), ('key3', 10)]", "assert maximum_value([('key1', [5, 6, 7]), ('key2',...
[]
843
Write a function to check whether the given key is present in the dictionary or not.
def len_log(list1): min=len(list1[0]) for i in list1: if len(i)<min: min=len(i) return min
[ "assert left_Rotate(16,2) == 64", "assert left_Rotate(10,2) == 40", "assert left_Rotate(99,3) == 792" ]
[]
708
Write a function to find the number which occurs for odd number of times in the given array.
def remove_empty(tuple1): #L = [(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')] tuple1 = [t for t in tuple1 if t] return tuple1
[ "assert Check_Vow('corner','AaEeIiOoUu') == 2", "assert Check_Vow('valid','AaEeIiOoUu') == 2", "assert Check_Vow('true','AaEeIiOoUu') ==2" ]
[]
818
Write a function to sort a list of lists by length and value.
import re def text_uppercase_lowercase(text): patterns = '[A-Z]+[a-z]+$' if re.search(patterns, text): return 'Found a match!' else: return ('Not matched!')
[ "assert pair_OR_Sum([5,9,7,6],4) == 47", "assert pair_OR_Sum([7,3,5],3) == 12", "assert pair_OR_Sum([7,3],2) == 4" ]
[]
887
Write a function to sum a specific column of a list in a given list of lists.
def power_base_sum(base, power): return sum([int(i) for i in str(pow(base, power))])
[ "assert get_ludic(10) == [1, 2, 3, 5, 7]", "assert get_ludic(25) == [1, 2, 3, 5, 7, 11, 13, 17, 23, 25]", "assert get_ludic(45) == [1, 2, 3, 5, 7, 11, 13, 17, 23, 25, 29, 37, 41, 43]" ]
[]
684
Write a function that matches a string that has an a followed by zero or more b's.
import math def area_tetrahedron(side): area = math.sqrt(3)*(side*side) return area
[ "assert check_subset((10, 4, 5, 6), (5, 10)) == True", "assert check_subset((1, 2, 3, 4), (5, 6)) == False", "assert check_subset((7, 8, 9, 10), (10, 8)) == True" ]
[]
932
Write a function that matches a string that has an 'a' followed by anything, ending in 'b'.
from heapq import merge def combine_lists(num1,num2): combine_lists=list(merge(num1, num2)) return combine_lists
[ "assert find_longest_conseq_subseq([1, 2, 2, 3], 4) == 3", "assert find_longest_conseq_subseq([1, 9, 3, 10, 4, 20, 2], 7) == 4", "assert find_longest_conseq_subseq([36, 41, 56, 35, 44, 33, 34, 92, 43, 32, 42], 11) == 5" ]
[]
677
Write a function to remove the nested record from the given tuple.
from collections import defaultdict def grouping_dictionary(l): d = defaultdict(list) for k, v in l: d[k].append(v) return d
[ "assert slope(4,2,2,5) == -1.5", "assert slope(2,4,4,6) == 1", "assert slope(1,2,4,2) == 0" ]
[]
667
Write a function where a string will start with a specific number.
def is_Word_Present(sentence,word): s = sentence.split(" ") for i in s: if (i == word): return True return False
[ "assert subset([1, 2, 3, 4],4) == 1", "assert subset([5, 6, 9, 3, 4, 3, 4],7) == 2", "assert subset([1, 2, 3 ],3) == 1" ]
[]
727
Write a function to caluclate perimeter of a parallelogram.
import itertools def remove_duplicate(list1): list.sort(list1) remove_duplicate = list(list1 for list1,_ in itertools.groupby(list1)) return remove_duplicate
[ "assert count_Divisors(10) == \"Even\"", "assert count_Divisors(100) == \"Odd\"", "assert count_Divisors(125) == \"Even\"" ]
[]
610
Write a function to search a literals string in a string and also find the location within the original string where the pattern occurs by using regex.
def sort_String(str) : str = ''.join(sorted(str)) return (str)
[ "assert increment_numerics([\"MSM\", \"234\", \"is\", \"98\", \"123\", \"best\", \"4\"] , 6) == ['MSM', '240', 'is', '104', '129', 'best', '10']", "assert increment_numerics([\"Dart\", \"356\", \"is\", \"88\", \"169\", \"Super\", \"6\"] , 12) == ['Dart', '368', 'is', '100', '181', 'Super', '18']", "assert incre...
[]
836
Write a function to find the equilibrium index of the given array.
def lucky_num(n): List=range(-1,n*n+9,2) i=2 while List[i:]:List=sorted(set(List)-set(List[List[i]::List[i]]));i+=1 return List[1:n+1]
[ "assert count_reverse_pairs([\"julia\", \"best\", \"tseb\", \"for\", \"ailuj\"])== '2'", "assert count_reverse_pairs([\"geeks\", \"best\", \"for\", \"skeeg\"]) == '1'", "assert count_reverse_pairs([\"makes\", \"best\", \"sekam\", \"for\", \"rof\"]) == '2' " ]
[]
854
Write a function to zip two given lists of lists.
import re def remove_parenthesis(items): for item in items: return (re.sub(r" ?\([^)]+\)", "", item))
[ "assert sort_sublists([[2], [0], [1, 3], [0, 7], [9, 11], [13, 15, 17]])==[[0], [2], [0, 7], [1, 3], [9, 11], [13, 15, 17]]", "assert sort_sublists([[1], [2, 3], [4, 5, 6], [7], [10, 11]])==[[1], [7], [2, 3], [10, 11], [4, 5, 6]]", "assert sort_sublists([[\"python\"],[\"java\",\"C\",\"C++\"],[\"DBMS\"],[\"SQL\"...
[]
656
Write a python function to find maximum possible value for the given periodic function.
def access_key(ditionary,key): return list(ditionary)[key]
[ "assert count_elim([10,20,30,(10,20),40])==3", "assert count_elim([10,(20,30),(10,20),40])==1", "assert count_elim([(10,(20,30,(10,20),40))])==0" ]
[]
601
Write a python function to toggle bits of the number except the first and the last bit.
def adjac(ele, sub = []): if not ele: yield sub else: yield from [idx for j in range(ele[0] - 1, ele[0] + 2) for idx in adjac(ele[1:], sub + [j])] def get_coordinates(test_tup): res = list(adjac(test_tup)) return (res)
[ "assert prime_num(13)==True", "assert prime_num(7)==True", "assert prime_num(-1010)==False" ]
[]
765
Write a function to re-arrange the given tuples based on the given ordered list.
import re regex = '''^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$''' def check_IP(Ip): if(re.search(regex, Ip)): return ("Valid IP address") else: return ("Invalid I...
[ "assert is_Product_Even([1,2,3],3) == True", "assert is_Product_Even([1,2,1,4],4) == True", "assert is_Product_Even([1,1],2) == False" ]
[]
969
Write a function to find the length of the longest sub-sequence such that elements in the subsequences are consecutive integers.
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_height(node): if node is None: return 0 ; else : left_height = max_height(node.left) right_height = max_height(node.right) if (left_height > right_height): return left_height+1 ...
[ "assert split_list(\"LearnToBuildAnythingWithGoogle\") == ['Learn', 'To', 'Build', 'Anything', 'With', 'Google']", "assert split_list(\"ApmlifyingTheBlack+DeveloperCommunity\") == ['Apmlifying', 'The', 'Black+', 'Developer', 'Community']", "assert split_list(\"UpdateInTheGoEcoSystem\") == ['Update', 'In', 'The'...
[]
802
Write a function to display sign of the chinese zodiac for given year.
import re def remove_extra_char(text1): pattern = re.compile('[\W_]+') return (pattern.sub('', text1))
[ "assert check_Even_Parity(10) == True", "assert check_Even_Parity(11) == False", "assert check_Even_Parity(18) == True" ]
[]
967
Write a function to check a decimal with a precision of 2.
def count_list(input_list): return (len(input_list))**2
[ "assert find_Min_Diff((1,5,3,19,18,25),6) == 1", "assert find_Min_Diff((4,3,2,6),4) == 1", "assert find_Min_Diff((30,5,20,9),4) == 4" ]
[]
661
Write a function to count occurrence of a character in a string.
def dealnnoy_num(n, m): if (m == 0 or n == 0) : return 1 return dealnnoy_num(m - 1, n) + dealnnoy_num(m - 1, n - 1) + dealnnoy_num(m, n - 1)
[ "assert sum_positivenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==48", "assert sum_positivenum([10,15,-14,13,-18,12,-20])==50", "assert sum_positivenum([19, -65, 57, 39, 152,-639, 121, 44, 90, -190])==522" ]
[]
635
Write a function to find the nth nonagonal number.
def clear_tuple(test_tup): temp = list(test_tup) temp.clear() test_tup = tuple(temp) return (test_tup)
[ "assert split_upperstring(\"PythonProgramLanguage\")==['Python','Program','Language']", "assert split_upperstring(\"PythonProgram\")==['Python','Program']", "assert split_upperstring(\"ProgrammingLanguage\")==['Programming','Language']" ]
[]
910
Write a function to extract specified number of elements from a given list, which follow each other continuously.
import re def text_match_zero_one(text): patterns = 'ab?' if re.search(patterns, text): return 'Found a match!' else: return('Not matched!')
[ "assert count_Fac(24) == 3", "assert count_Fac(12) == 2", "assert count_Fac(4) == 1" ]
[]
908
Write a function to find palindromes in a given list of strings using lambda function.
def swap_List(newList): size = len(newList) temp = newList[0] newList[0] = newList[size - 1] newList[size - 1] = temp return newList
[ "assert sector_area(4,45)==6.285714285714286", "assert sector_area(9,45)==31.82142857142857", "assert sector_area(9,360)==None" ]
[]
621
Write a function to check if each element of second tuple is smaller than its corresponding index in first tuple.
def recur_gcd(a, b): low = min(a, b) high = max(a, b) if low == 0: return high elif low == 1: return 1 else: return recur_gcd(low, high%low)
[ "assert rombus_area(10,20)==100", "assert rombus_area(10,5)==25", "assert rombus_area(4,2)==4" ]
[]
787
Write a function to locate the right insertion point for a specified value in sorted order.
import math def round_up(a, digits): n = 10**-digits return round(math.ceil(a / n) * n, digits)
[ "assert count_even([1, 2, 3, 5, 7, 8, 9, 10])==3", "assert count_even([10,15,14,13,-18,12,-20])==5", "assert count_even([1, 2, 4, 8, 9])==3" ]
[]
758
Write a function to sort a given list of strings of numbers numerically.
def maximum_segments(n, a, b, c) : dp = [-1] * (n + 10) dp[0] = 0 for i in range(0, n) : if (dp[i] != -1) : if(i + a <= n ): dp[i + a] = max(dp[i] + 1, dp[i + a]) if(i + b <= n ): dp[i + b] = max(dp[i] + 1, dp[i + b]) if(i + c <= n ): dp[i + c] = max(dp[i] ...
[ "assert count_Pairs([1,1,1,1],4) == 6", "assert count_Pairs([1,5,1],3) == 1", "assert count_Pairs([3,2,1,7,8,9],6) == 0" ]
[]
783
Write a function to extract the maximum numeric value from a string by using regex.
def same_Length(A,B): while (A > 0 and B > 0): A = A / 10; B = B / 10; if (A == 0 and B == 0): return True; return False;
[ "assert check(\"SEEquoiaL\") == 'accepted'", "assert check('program') == \"not accepted\"", "assert check('fine') == \"not accepted\"" ]
[]
632
Write a python function to check whether the roots of a quadratic equation are numerically equal but opposite in sign or not.
def remove_spaces(str1): str1 = str1.replace(' ','') return str1
[ "assert rearrange_numbs([-1, 2, -3, 5, 7, 8, 9, -10])==[2, 5, 7, 8, 9, -10, -3, -1]", "assert rearrange_numbs([10,15,14,13,-18,12,-20])==[10, 12, 13, 14, 15, -20, -18]", "assert rearrange_numbs([-20,20,-10,10,-30,30])==[10, 20, 30, -30, -20, -10]" ]
[]
867
Write a function to list out the list of given strings individually using map function.
def pair_wise(l1): temp = [] for i in range(len(l1) - 1): current_element, next_element = l1[i], l1[i + 1] x = (current_element, next_element) temp.append(x) return temp
[ "assert count_Unset_Bits(2) == 1", "assert count_Unset_Bits(5) == 4", "assert count_Unset_Bits(14) == 17" ]
[]
613
Write a function to find the occurrence and position of the substrings within a string.
def min_Num(arr,n): odd = 0 for i in range(n): if (arr[i] % 2): odd += 1 if (odd % 2): return 1 return 2
[ "assert return_sum({'a': 100, 'b':200, 'c':300}) == 600", "assert return_sum({'a': 25, 'b':18, 'c':45}) == 88", "assert return_sum({'a': 36, 'b':39, 'c':49}) == 124" ]
[]
929
Write a function to add all the numbers in a list and divide it with the length of the list.
def max_of_three(num1,num2,num3): if (num1 >= num2) and (num1 >= num3): lnum = num1 elif (num2 >= num1) and (num2 >= num3): lnum = num2 else: lnum = num3 return lnum
[ "assert cheap_items([{'name': 'Item-1', 'price': 101.1},{'name': 'Item-2', 'price': 555.22}],1)==[{'name': 'Item-1', 'price': 101.1}]", "assert cheap_items([{'name': 'Item-1', 'price': 101.1},{'name': 'Item-2', 'price': 555.22}],2)==[{'name': 'Item-1', 'price': 101.1},{'name': 'Item-2', 'price': 555.22}]", "ass...
[]
860
Write a function that matches a string that has an a followed by zero or more b's by using regex.
def camel_to_snake(text): import re str1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', text) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', str1).lower()
[ "assert Extract([[1, 2, 3], [4, 5], [6, 7, 8, 9]]) == [3, 5, 9]", "assert Extract([['x', 'y', 'z'], ['m'], ['a', 'b'], ['u', 'v']]) == ['z', 'm', 'b', 'v']", "assert Extract([[1, 2, 3], [4, 5]]) == [3, 5]" ]
[]
735
Write a function to find the area of a rombus.
import math def sum_of_odd_Factors(n): res = 1 while n % 2 == 0: n = n // 2 for i in range(3,int(math.sqrt(n) + 1)): count = 0 curr_sum = 1 curr_term = 1 while n % i == 0: count+=1 n = n // i curr_term *= i ...
[ "assert min_sum_path([[ 2 ], [3, 9 ], [1, 6, 7 ]]) == 6", "assert min_sum_path([[ 2 ], [3, 7 ], [8, 5, 6 ]]) == 10 ", "assert min_sum_path([[ 3 ], [6, 4 ], [5, 2, 7 ]]) == 9" ]
[]
872
Write a function to remove all tuples with all none values in the given tuple list.
from collections import defaultdict def freq_element(test_tup): res = defaultdict(int) for ele in test_tup: res[ele] += 1 return (str(dict(res)))
[ "assert chunk_tuples((10, 4, 5, 6, 7, 6, 8, 3, 4), 3) == [(10, 4, 5), (6, 7, 6), (8, 3, 4)]", "assert chunk_tuples((1, 2, 3, 4, 5, 6, 7, 8, 9), 2) == [(1, 2), (3, 4), (5, 6), (7, 8), (9,)]", "assert chunk_tuples((11, 14, 16, 17, 19, 21, 22, 25), 4) == [(11, 14, 16, 17), (19, 21, 22, 25)]" ]
[]
954
Write a function that gives profit amount if the given amount has profit else return none.
def lcm(x, y): if x > y: z = x else: z = y while(True): if((z % x == 0) and (z % y == 0)): lcm = z break z += 1 return lcm
[ "assert Repeat([10, 20, 30, 20, 20, 30, 40, 50, -20, 60, 60, -20, -20]) == [20, 30, -20, 60]", "assert Repeat([-1, 1, -1, 8]) == [-1]", "assert Repeat([1, 2, 3, 1, 2,]) == [1, 2]" ]
[]
615
Write a function to check whether the given ip address is valid or not using regex.
import heapq def cheap_items(items,n): cheap_items = heapq.nsmallest(n, items, key=lambda s: s['price']) return cheap_items
[ "assert new_tuple([\"WEB\", \"is\"], \"best\") == ('WEB', 'is', 'best')", "assert new_tuple([\"We\", \"are\"], \"Developers\") == ('We', 'are', 'Developers')", "assert new_tuple([\"Part\", \"is\"], \"Wrong\") == ('Part', 'is', 'Wrong')" ]
[]
941
Write a function to generate a square matrix filled with elements from 1 to n raised to the power of 2 in spiral order.
from itertools import combinations def find_combinations(test_list): res = [(b1 + a1, b2 + a2) for (a1, a2), (b1, b2) in combinations(test_list, 2)] return (res)
[ "assert get_unique([(3, 4), (1, 2), (2, 4), (8, 2), (7, 2), (8, 1), (9, 1), (8, 4), (10, 4)] ) == '{4: 4, 2: 3, 1: 2}'", "assert get_unique([(4, 5), (2, 3), (3, 5), (9, 3), (8, 3), (9, 2), (10, 2), (9, 5), (11, 5)] ) == '{5: 4, 3: 3, 2: 2}'", "assert get_unique([(6, 5), (3, 4), (2, 6), (11, 1), (8, 22), (8, 11)...
[]
948
Write a python function to find the sum of non-repeated elements in a given array.
import sys def find_closet(A, B, C, p, q, r): diff = sys.maxsize res_i = 0 res_j = 0 res_k = 0 i = 0 j = 0 k = 0 while(i < p and j < q and k < r): minimum = min(A[i], min(B[j], C[k])) maximum = max(A[i], max(B[j], C[k])); if maximum-minimum < diff: res_i = i res_j = j re...
[ "assert add_dict({'a': 100, 'b': 200, 'c':300},{'a': 300, 'b': 200, 'd':400})==({'b': 400, 'd': 400, 'a': 400, 'c': 300}) ", "assert add_dict({'a': 500, 'b': 700, 'c':900},{'a': 500, 'b': 600, 'd':900})==({'b': 1300, 'd': 900, 'a': 1000, 'c': 900}) ", "assert add_dict({'a':900,'b':900,'d':900},{'a':900,'b':900,...
[]
714
Write a python function to check whether the given number can be represented by sum of two squares or not.
def return_sum(dict): sum = 0 for i in dict.values(): sum = sum + i return sum
[ "assert sum_num((8, 2, 3, 0, 7))==4.0", "assert sum_num((-10,-20,-30))==-20.0", "assert sum_num((19,15,18))==17.333333333333332" ]
[]
795
Write a function to iterate over elements repeating each as many times as its count.
def super_seq(X, Y, m, n): if (not m): return n if (not n): return m if (X[m - 1] == Y[n - 1]): return 1 + super_seq(X, Y, m - 1, n - 1) return 1 + min(super_seq(X, Y, m - 1, n), super_seq(X, Y, m, n - 1))
[ "assert convert([1,2,3]) == 123", "assert convert([4,5,6]) == 456", "assert convert([7,8,9]) == 789" ]
[]
863
Write a function to remove consecutive duplicates of a given list.
def test_three_equal(x,y,z): result= set([x,y,z]) if len(result)==3: return 0 else: return (4-len(result))
[ "assert sub_lists([10, 20, 30, 40])==[[], [10], [20], [30], [40], [10, 20], [10, 30], [10, 40], [20, 30], [20, 40], [30, 40], [10, 20, 30], [10, 20, 40], [10, 30, 40], [20, 30, 40], [10, 20, 30, 40]]", "assert sub_lists(['X', 'Y', 'Z'])==[[], ['X'], ['Y'], ['Z'], ['X', 'Y'], ['X', 'Z'], ['Y', 'Z'], ['X', 'Y', 'Z'...
[]
End of preview. Expand in Data Studio

edition_3113_google-research-datasets-mbpp-readymade

A Readymade by TheFactoryX

Original Dataset

google-research-datasets/mbpp

Process

This dataset is a "readymade" - inspired by Marcel Duchamp's concept of taking everyday objects and recontextualizing them as art.

What we did:

  1. Selected the original dataset from Hugging Face
  2. Shuffled each column independently
  3. Destroyed all row-wise relationships
  4. Preserved structure, removed meaning

The result: Same data. Wrong order. New meaning. No meaning.

Purpose

This is art. This is not useful. This is the point.

Column relationships have been completely destroyed. The data maintains its types and values, but all semantic meaning has been removed.


Part of the Readymades project by TheFactoryX.

"I am a machine." — Andy Warhol

Downloads last month
7