task_id int64 601 974 | text stringlengths 38 249 | code stringlengths 30 908 | test_list listlengths 3 3 | test_setup_code stringclasses 2
values | challenge_test_list listlengths 0 0 |
|---|---|---|---|---|---|
922 | Write a python function to find the first digit in factorial of a given number. | def nCr_mod_p(n, r, p):
if (r > n- r):
r = n - r
C = [0 for i in range(r + 1)]
C[0] = 1
for i in range(1, n + 1):
for j in range(min(i, r), 0, -1):
C[j] = (C[j] + C[j-1]) % p
return C[r] | [
"assert text_starta_endb(\"aabbbb\")==('Found a match!')",
"assert text_starta_endb(\"aabAbbbc\")==('Not matched!')",
"assert text_starta_endb(\"accddbbjjj\")==('Not matched!')"
] | [] | |
928 | Write a function to sort a list in a dictionary. | def tuple_to_dict(test_tup):
res = dict(test_tup[idx : idx + 2] for idx in range(0, len(test_tup), 2))
return (res) | [
"assert wind_chill(120,35)==40",
"assert wind_chill(40,70)==86",
"assert wind_chill(10,100)==116"
] | [] | |
714 | Write a function to find numbers within a given range where every number is divisible by every digit it contains. | def even_num(x):
if x%2==0:
return True
else:
return False | [
"assert raw_heap([25, 44, 68, 21, 39, 23, 89])==[21, 25, 23, 44, 39, 68, 89]",
"assert raw_heap([25, 35, 22, 85, 14, 65, 75, 25, 58])== [14, 25, 22, 25, 35, 65, 75, 85, 58]",
"assert raw_heap([4, 5, 6, 2])==[2, 4, 6, 5]"
] | [] | |
940 | Write function to find the sum of all items in the given dictionary. | def int_to_roman( num):
val = [1000, 900, 500, 400,100, 90, 50, 40,10, 9, 5, 4,1]
syb = ["M", "CM", "D", "CD","C", "XC", "L", "XL","X", "IX", "V", "IV","I"]
roman_num = ''
i = 0
while num > 0:
for _ in range(num // val[i]):
roman_num += syb[i]
... | [
"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"
] | [] | |
809 | Write a function to remove sublists from a given list of lists, which are outside a given range. | def harmonic_sum(n):
if n < 2:
return 1
else:
return 1 / n + (harmonic_sum(n - 1)) | [
"assert int_to_roman(1)==(\"I\")",
"assert int_to_roman(50)==(\"L\")",
"assert int_to_roman(4)==(\"IV\")"
] | [] | |
688 | Write a function to concatenate the given two tuples to a nested tuple. | def move_last(num_list):
a = [num_list[0] for i in range(num_list.count(num_list[0]))]
x = [ i for i in num_list if i != num_list[0]]
x.extend(a)
return (x) | [
"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"
] | [] | |
904 | Write a function to rearrange positive and negative numbers in a given array using lambda function. | def average_tuple(nums):
result = [sum(x) / len(x) for x in zip(*nums)]
return result | [
"assert min_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 1",
"assert min_difference([(4, 6), (12, 8), (11, 4), (2, 13)]) == 2",
"assert min_difference([(5, 17), (3, 9), (12, 5), (3, 24)]) == 6"
] | [] | |
636 | Write a function to find the longest common subsequence for the given three string sequence. | def last(n):
return n[-1]
def sort_list_last(tuples):
return sorted(tuples, key=last) | [
"assert pack_consecutive_duplicates([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4])==[[0, 0], [1], [2], [3], [4, 4], [5], [6, 6, 6], [7], [8], [9], [4, 4]]",
"assert pack_consecutive_duplicates([10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10])==[[10, 10], [15], [19], [18, 18], [17], [26, 26], [17], [18], [10]]"... | [] | |
753 | Write a python function to find the sum of fourth power of first n even natural numbers. | def check_Concat(str1,str2):
N = len(str1)
M = len(str2)
if (N % M != 0):
return False
for i in range(N):
if (str1[i] != str2[i % M]):
return False
return True | [
"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]"
] | [] | |
723 | Write a function to find maximum run of uppercase characters in the given string. | def multiply_elements(test_tup):
res = tuple(i * j for i, j in zip(test_tup, test_tup[1:]))
return (res) | [
"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"
] | [] | |
683 | Write a python function to count the total set bits from 1 to n. | import re
def end_num(string):
text = re.compile(r".*[0-9]$")
if text.match(string):
return True
else:
return False | [
"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"
] | [] | |
906 | Write a function to find nth polite number. | def remove_even(l):
for i in l:
if i % 2 == 0:
l.remove(i)
return l | [
"assert lcs_of_three('AGGT12', '12TXAYB', '12XBA', 6, 7, 5) == 2",
"assert lcs_of_three('Reels', 'Reelsfor', 'ReelsforReels', 5, 8, 13) == 5 ",
"assert lcs_of_three('abcd1e2', 'bc12ea', 'bd1ea', 7, 6, 5) == 3"
] | [] | |
896 | Write a function to find the minimum difference in the tuple pairs of given tuples. | 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 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] "
] | [] | |
709 | ## write a function to find the minimum number of jumps to reach the end of the array for the given array of integers where each element represents the max number of steps that can be made forward from that element. > indented block > indented block | 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 n_common_words(\"python is a programming language\",1)==[('python', 1)]",
"assert n_common_words(\"python is a programming language\",1)==[('python', 1)]",
"assert n_common_words(\"python is a programming language\",5)==[('python', 1),('is', 1), ('a', 1), ('programming', 1), ('language', 1)]"
] | [] | |
944 | Write a function to find the length of the longest sub-sequence such that elements in the subsequences are consecutive integers. | def max_of_nth(test_list, N):
res = max([sub[N] for sub in test_list])
return (res) | [
"assert bell_Number(2) == 2",
"assert bell_Number(3) == 5",
"assert bell_Number(4) == 15"
] | [] | |
905 | Write a function to find the n-th power of individual elements in a list using lambda function. | 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 last_Two_Digits(7) == 40",
"assert last_Two_Digits(5) == 20",
"assert last_Two_Digits(2) == 2"
] | [] | |
836 | Write a function to sort a list of dictionaries using lambda function. | def mul_list(nums1,nums2):
result = map(lambda x, y: x * y, nums1, nums2)
return list(result) | [
"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)... | [] | |
755 | Write a function to group a sequence of key-value pairs into a dictionary of lists using collections module. | def first_odd(nums):
first_odd = next((el for el in nums if el%2!=0),-1)
return first_odd | [
"assert dealnnoy_num(3, 4) == 129",
"assert dealnnoy_num(3, 3) == 63",
"assert dealnnoy_num(4, 5) == 681"
] | [] | |
870 | Write a python function to find the slope of a line. | def subset(ar, n):
res = 0
ar.sort()
for i in range(0, n) :
count = 1
for i in range(n - 1):
if ar[i] == ar[i + 1]:
count+=1
else:
break
res = max(res, count)
return res | [
"assert sum_column( [[1,2,3,2],[4,5,6,2],[7,8,9,5],],0)==12",
"assert sum_column( [[1,2,3,2],[4,5,6,2],[7,8,9,5],],1)==15",
"assert sum_column( [[1,2,3,2],[4,5,6,2],[7,8,9,5],],3)==9"
] | [] | |
866 | Write a function that matches a string that has an 'a' followed by anything, ending in 'b'. | import re
def road_rd(street):
return (re.sub('Road$', 'Rd.', street)) | [
"assert validity_triangle(60,50,90)==False",
"assert validity_triangle(45,75,60)==True",
"assert validity_triangle(30,50,100)==True"
] | [] | |
953 | Write a python function to check whether the given two arrays are equal or not. | def profit_amount(actual_cost,sale_amount):
if(actual_cost > sale_amount):
amount = actual_cost - sale_amount
return amount
else:
return None | [
"assert sort_dict_item({(5, 6) : 3, (2, 3) : 9, (8, 4): 10, (6, 4): 12} ) == {(2, 3): 9, (6, 4): 12, (5, 6): 3, (8, 4): 10}",
"assert sort_dict_item({(6, 7) : 4, (3, 4) : 10, (9, 5): 11, (7, 5): 13} ) == {(3, 4): 10, (7, 5): 13, (6, 7): 4, (9, 5): 11}",
"assert sort_dict_item({(7, 8) : 5, (4, 5) : 11, (10, 6): ... | [] | |
664 | Write a function to find the nth nonagonal number. | def is_Isomorphic(str1,str2):
dict_str1 = {}
dict_str2 = {}
for i, value in enumerate(str1):
dict_str1[value] = dict_str1.get(value,[]) + [i]
for j, value in enumerate(str2):
dict_str2[value] = dict_str2.get(value,[]) + [j]
if sorted(dict_str1.values()) == so... | [
"assert text_match(\"ac\")==('Found a match!')",
"assert text_match(\"dc\")==('Not matched!')",
"assert text_match(\"abba\")==('Found a match!')"
] | [] | |
754 | Write a function to check if the given array represents min heap or not. | def last_Two_Digits(N):
if (N >= 10):
return
fac = 1
for i in range(1,N + 1):
fac = (fac * i) % 100
return (fac) | [
"assert get_odd_occurence([2, 3, 5, 4, 5, 2, 4, 3, 5, 2, 4, 4, 2], 13) == 5",
"assert get_odd_occurence([1, 2, 3, 2, 3, 1, 3], 7) == 3",
"assert get_odd_occurence([5, 7, 2, 7, 5, 2, 5], 7) == 5"
] | [] | |
654 | Write a python function to find the last two digits in factorial of a given number. | def even_Power_Sum(n):
sum = 0;
for i in range(1,n + 1):
j = 2*i;
sum = sum + (j*j*j*j);
return sum; | [
"assert count_duplic([1,2,2,2,4,4,4,5,5,5,5])==([1, 2, 4, 5], [1, 3, 3, 4])",
"assert count_duplic([2,2,3,1,2,6,7,9])==([2, 3, 1, 2, 6, 7, 9], [2, 1, 1, 1, 1, 1, 1])",
"assert count_duplic([2,1,5,6,8,3,4,9,10,11,8,12])==([2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])"
] | [] | |
702 | Write a function to count repeated items of a tuple. | def count_elim(num):
count_elim = 0
for n in num:
if isinstance(n, tuple):
break
count_elim += 1
return count_elim | [
"assert is_odd(5) == True",
"assert is_odd(6) == False",
"assert is_odd(7) == True"
] | [] | |
621 | Write a function to caluclate perimeter of a parallelogram. | def check_Odd_Parity(x):
parity = 0
while (x != 0):
x = x & (x - 1)
parity += 1
if (parity % 2 == 1):
return True
else:
return False | [
"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... | [] | |
712 | Write a function to exchange the position of every n-th value with (n+1)th value and (n+1)th value with n-th value in a given list. | def fibonacci(n):
if n == 1 or n == 2:
return 1
else:
return (fibonacci(n - 1) + (fibonacci(n - 2))) | [
"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,... | [] | |
648 | Write a python function to copy a list from a singleton tuple. | 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 remove_length('The person is most value tet', 3) == 'person is most value'",
"assert remove_length('If you told me about this ok', 4) == 'If you me about ok'",
"assert remove_length('Forces of darkeness is come into the play', 4) == 'Forces of darkeness is the'"
] | [] | |
731 | Write a python function to find the sum of all odd natural numbers within the range l and r. | 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 pass_validity(\"password\")==False",
"assert pass_validity(\"Password@10\")==True",
"assert pass_validity(\"password@10\")==False"
] | [] | |
771 | Write a function to check whether the given month number contains 28 days or not. | def is_nonagonal(n):
return int(n * (7 * n - 5) / 2) | [
"assert slope(4,2,2,5) == -1.5",
"assert slope(2,4,4,6) == 1",
"assert slope(1,2,4,2) == 0"
] | [] | |
898 | Write a function to substract the elements of the given nested tuples. | def min_Jumps(a, b, d):
temp = a
a = min(a, b)
b = max(temp, b)
if (d >= b):
return (d + b - 1) / b
if (d == 0):
return 0
if (d == a):
return 1
else:
return 2 | [
"assert sum_list([10,20,30],[15,25,35])==[25,45,65]",
"assert sum_list([1,2,3],[5,6,7])==[6,8,10]",
"assert sum_list([15,20,30],[15,45,75])==[30,65,105]"
] | [] | |
703 | Write a function to locate the right insertion point for a specified value in sorted order. | from collections import Counter
def most_common_elem(s,a):
most_common_elem=Counter(s).most_common(a)
return most_common_elem | [
"assert merge([['x', 'y'], ['a', 'b'], ['m', 'n']]) == [['x', 'a', 'm'], ['y', 'b', 'n']]",
"assert merge([[1, 2], [3, 4], [5, 6], [7, 8]]) == [[1, 3, 5, 7], [2, 4, 6, 8]]",
"assert merge([['x', 'y','z' ], ['a', 'b','c'], ['m', 'n','o']]) == [['x', 'a', 'm'], ['y', 'b', 'n'],['z', 'c','o']]"
] | [] | |
880 | Write a function to count the frequency of consecutive duplicate elements in a given list of numbers. | def unique_sublists(list1):
result ={}
for l in list1:
result.setdefault(tuple(l), list()).append(1)
for a, b in result.items():
result[a] = sum(b)
return result | [
"assert check_date(11,11,2002)==True",
"assert check_date(13,11,2002)==False",
"assert check_date('11','11','2002')==True"
] | [] | |
783 | Write a python function to remove negative numbers from a list. | def clear_tuple(test_tup):
temp = list(test_tup)
temp.clear()
test_tup = tuple(temp)
return (test_tup) | [
"assert div_of_nums([19, 65, 57, 39, 152, 639, 121, 44, 90, 190],19,13)==[19, 65, 57, 39, 152, 190]",
"assert div_of_nums([1, 2, 3, 5, 7, 8, 10],2,5)==[2, 5, 8, 10]",
"assert div_of_nums([10,15,14,13,18,12,20],10,5)==[10, 15, 20]"
] | [] | |
882 | Write a function to calculate the sum of series 1²+2²+3²+….+n². | def filter_data(students,h,w):
result = {k: s for k, s in students.items() if s[0] >=h and s[1] >=w}
return result | [
"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]"
] | [] | |
717 | Write a python function to find the first odd number in a given list of numbers. | def count_Pairs(arr,n):
cnt = 0;
for i in range(n):
for j in range(i + 1,n):
if (arr[i] == arr[j]):
cnt += 1;
return cnt; | [
"assert noprofit_noloss(1500,1200)==False",
"assert noprofit_noloss(100,100)==True",
"assert noprofit_noloss(2000,5000)==False"
] | [] | |
891 | Write a function to find minimum of two numbers. | def decreasing_trend(nums):
if (sorted(nums)== nums):
return True
else:
return False | [
"assert jacobsthal_num(5) == 11",
"assert jacobsthal_num(2) == 1",
"assert jacobsthal_num(4) == 5"
] | [] | |
948 | Write a function to put spaces between words starting with capital letters in a given string by using regex. | def add_tuple(test_list, test_tup):
test_list += test_tup
return (test_list) | [
"assert check_monthnum_number(2)==True",
"assert check_monthnum_number(1)==False",
"assert check_monthnum_number(3)==False"
] | [] | |
667 | Write a function that matches a string that has an a followed by three 'b'. | def binomial_coeffi(n, k):
if (k == 0 or k == n):
return 1
return (binomial_coeffi(n - 1, k - 1)
+ binomial_coeffi(n - 1, k))
def rencontres_number(n, m):
if (n == 0 and m == 0):
return 1
if (n == 1 and m == 0):
return 0
if (m == 0):
return ((n - 1) * (rencontres_number(n - 1, 0)+ renc... | [
"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'... | [] | |
841 | Write a function to sort the given tuple list basis the total digits in tuple. | def sort_sublists(list1):
list1.sort()
list1.sort(key=len)
return list1 | [
"assert min_Swaps(\"0011\",\"1111\") == 1",
"assert min_Swaps(\"00011\",\"01001\") == 2",
"assert min_Swaps(\"111\",\"111\") == 0"
] | [] | |
786 | Write a function to find out the second most repeated (or frequent) string in the given sequence. | def find_Points(l1,r1,l2,r2):
x = min(l1,l2) if (l1 != l2) else -1
y = max(r1,r2) if (r1 != r2) else -1
return (x,y) | [
"assert remove_all_spaces('python program')==('pythonprogram')",
"assert remove_all_spaces('python programming language')==('pythonprogramminglanguage')",
"assert remove_all_spaces('python program')==('pythonprogram')"
] | [] | |
917 | Write a function to find palindromes in a given list of strings using lambda function. | 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 count_vowels('bestinstareels') == 7",
"assert count_vowels('partofthejourneyistheend') == 12",
"assert count_vowels('amazonprime') == 5"
] | [] | |
661 | Write a function to find the frequency of each element in the given list. | 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 sort_String(\"cba\") == \"abc\"",
"assert sort_String(\"data\") == \"aadt\"",
"assert sort_String(\"zxy\") == \"xyz\""
] | [] | |
885 | Write a function to find whether an array is subset of another array. | def float_to_tuple(test_str):
res = tuple(map(float, test_str.split(', ')))
return (res) | [
"assert check_monthnumber_number(6)==True",
"assert check_monthnumber_number(2)==False",
"assert check_monthnumber_number(12)==False"
] | [] | |
839 | Write a python function to access multiple elements of specified index from a given list. | def check_Type_Of_Triangle(a,b,c):
sqa = pow(a,2)
sqb = pow(b,2)
sqc = pow(c,2)
if (sqa == sqa + sqb or sqb == sqa + sqc or sqc == sqa + sqb):
return ("Right-angled Triangle")
elif (sqa > sqc + sqb or sqb > sqa + sqc or sqc > sqa + sqb):
return ("Obtuse-angled Triangle"... | [
"assert check_Odd_Parity(13) == True",
"assert check_Odd_Parity(21) == True",
"assert check_Odd_Parity(18) == False"
] | [] | |
624 | Write a function to join the tuples if they have similar initial elements. | def string_length(str1):
count = 0
for char in str1:
count += 1
return count | [
"assert access_elements([2,3,8,4,7,9],[0,3,5]) == [2, 4, 9]",
"assert access_elements([1, 2, 3, 4, 5],[1,2]) == [2,3]",
"assert access_elements([1,0,2,3],[0,1]) == [1,0]"
] | [] | |
766 | Write a python function to find the length of the last word in a given string. | def count_duplic(lists):
element = []
frequency = []
if not lists:
return element
running_count = 1
for i in range(len(lists)-1):
if lists[i] == lists[i+1]:
running_count += 1
else:
frequency.append(running_count)
element.append(... | [
"assert add_tuple([5, 6, 7], (9, 10)) == [5, 6, 7, 9, 10]",
"assert add_tuple([6, 7, 8], (10, 11)) == [6, 7, 8, 10, 11]",
"assert add_tuple([7, 8, 9], (11, 12)) == [7, 8, 9, 11, 12]"
] | [] | |
676 | Write a function to count unique keys for each value present in the tuple. | from collections import deque
def check_expression(exp):
if len(exp) & 1:
return False
stack = deque()
for ch in exp:
if ch == '(' or ch == '{' or ch == '[':
stack.append(ch)
if ch == ')' or ch == '}' or ch == ']':
if not stack:
retur... | [
"assert arc_length(9,45)==3.5357142857142856",
"assert arc_length(9,480)==None",
"assert arc_length(5,270)==11.785714285714285"
] | [] | |
746 | Write a function to iterate over all pairs of consecutive items in a given list. | def access_key(ditionary,key):
return list(ditionary)[key] | [
"assert check_email(\"ankitrai326@gmail.com\") == 'Valid Email'",
"assert check_email(\"my.ownsite@ourearth.org\") == 'Valid Email'",
"assert check_email(\"ankitaoie326.com\") == 'Invalid Email'"
] | [] | |
850 | Write a python function to find the sum of all even natural numbers within the range l and r. | def sample_nam(sample_names):
sample_names=list(filter(lambda el:el[0].isupper() and el[1:].islower(),sample_names))
return len(''.join(sample_names)) | [
"assert check_substring(\"dreams for dreams makes life fun\", \"makes\") == 'string doesnt start with the given substring'",
"assert check_substring(\"Hi there how are you Hi alex\", \"Hi\") == 'string starts with the given substring'",
"assert check_substring(\"Its been a long day\", \"been\") == 'string doesn... | [] | |
951 | Write a function that gives profit amount if the given amount has profit else return none. | def get_odd_occurence(arr, arr_size):
for i in range(0, arr_size):
count = 0
for j in range(0, arr_size):
if arr[i] == arr[j]:
count += 1
if (count % 2 != 0):
return arr[i]
return -1 | [
"assert split_upperstring(\"PythonProgramLanguage\")==['Python','Program','Language']",
"assert split_upperstring(\"PythonProgram\")==['Python','Program']",
"assert split_upperstring(\"ProgrammingLanguage\")==['Programming','Language']"
] | [] | |
727 | Write a python function to accept the strings which contains all vowels. | def remove_similar_row(test_list):
res = set(sorted([tuple(sorted(set(sub))) for sub in test_list]))
return (res) | [
"assert count_Char(\"abcac\",'a') == 4",
"assert count_Char(\"abca\",'c') == 2",
"assert count_Char(\"aba\",'a') == 7"
] | [] | |
873 | Write a function to compute maximum product of three numbers of a given array of integers using heap queue algorithm. | def max_of_two( x, y ):
if x > y:
return x
return y | [
"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')"
] | [] | |
671 | Write a function to solve tiling problem. | 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 recur_gcd(12,14) == 2",
"assert recur_gcd(13,17) == 1",
"assert recur_gcd(9, 3) == 3"
] | [] | |
937 | Write a function to display sign of the chinese zodiac for given year. | def check_monthnum_number(monthnum1):
if monthnum1 == 2:
return True
else:
return False | [
"assert sum_nums(2,10,11,20)==20",
"assert sum_nums(15,17,1,10)==32",
"assert sum_nums(10,15,5,30)==20"
] | [] | |
889 | Write a python function to choose points from two ranges such that no point lies in both the ranges. | def find_longest_conseq_subseq(arr, n):
ans = 0
count = 0
arr.sort()
v = []
v.append(arr[0])
for i in range(1, n):
if (arr[i] != arr[i - 1]):
v.append(arr[i])
for i in range(len(v)):
if (i > 0 and v[i] == v[i - 1] + 1):
count += 1
else:
count = 1
ans = max(ans, count)
... | [
"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)]"
] | [] | |
949 | Write a python function to calculate the product of all the numbers of a given tuple. | import math
def count_Divisors(n) :
count = 0
for i in range(1, (int)(math.sqrt(n)) + 2) :
if (n % i == 0) :
if( n // i == i) :
count = count + 1
else :
count = count + 2
if (count % 2 == 0) :
return ("Even")
else... | [
"assert len_log([\"win\",\"lose\",\"great\"]) == 3",
"assert len_log([\"a\",\"ab\",\"abc\"]) == 1",
"assert len_log([\"12\",\"12\",\"1234\"]) == 2"
] | [] | |
732 | Write a function to sort a given list of strings of numbers numerically. | def arc_length(d,a):
pi=22/7
if a >= 360:
return None
arclength = (pi*d) * (a/360)
return arclength | [
"assert is_subset([11, 1, 13, 21, 3, 7], 6, [11, 3, 7, 1], 4) == True",
"assert is_subset([1, 2, 3, 4, 5, 6], 6, [1, 2, 4], 3) == True",
"assert is_subset([10, 5, 2, 23, 19], 5, [19, 5, 3], 3) == False"
] | [] | |
960 | 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 power_base_sum(base, power):
return sum([int(i) for i in str(pow(base, power))]) | [
"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"
] | [] | |
820 | Write a python function to left rotate the bits of a given number. | def slope(x1,y1,x2,y2):
return (float)(y2-y1)/(x2-x1) | [
"assert find_max_val(15, 10, 5) == 15",
"assert find_max_val(187, 10, 5) == 185",
"assert find_max_val(16, 11, 1) == 12"
] | [] | |
811 | Write a function to convert camel case string to snake case string by using regex. | def floor_Min(A,B,N):
x = max(B - 1,N)
return (A*x) // B | [
"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"
] | [] | |
726 | Write a function to find the median of two sorted arrays of same size. | import math
def sum_series(number):
total = 0
total = math.pow((number * (number + 1)) /2, 2)
return total | [
"assert capital_words_spaces(\"Python\") == 'Python'",
"assert capital_words_spaces(\"PythonProgrammingExamples\") == 'Python Programming Examples'",
"assert capital_words_spaces(\"GetReadyToBeCodingFreak\") == 'Get Ready To Be Coding Freak'"
] | [] | |
872 | Write a python function to check whether an array contains only one distinct element or not. | def check(string):
if len(set(string).intersection("AEIOUaeiou"))>=5:
return ('accepted')
else:
return ("not accepted") | [
"assert find_literals('The quick brown fox jumps over the lazy dog.', 'fox') == ('fox', 16, 19)",
"assert find_literals('Its been a very crazy procedure right', 'crazy') == ('crazy', 16, 21)",
"assert find_literals('Hardest choices required strongest will', 'will') == ('will', 35, 39)"
] | [] | |
698 | Write a function to check if two lists of tuples are identical or not. | def tuple_modulo(test_tup1, test_tup2):
res = tuple(ele1 % ele2 for ele1, ele2 in zip(test_tup1, test_tup2))
return (res) | [
"assert test_three_equal(1,1,1) == 3",
"assert test_three_equal(-1,-2,-3) == 0",
"assert test_three_equal(1,2,2) == 2"
] | [] | |
833 | Write a python function to count equal element pairs from the given array. | 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_expression(\"{()}[{}]\") == True",
"assert check_expression(\"{()}[{]\") == False",
"assert check_expression(\"{()}[{}][]({})\") == True"
] | [] | |
816 | Write a function to find the minimum number of elements that should be removed such that amax-amin<=k. | from heapq import merge
def combine_lists(num1,num2):
combine_lists=list(merge(num1, num2))
return combine_lists | [
"assert camel_to_snake('PythonProgram')==('python_program')",
"assert camel_to_snake('pythonLanguage')==('python_language')",
"assert camel_to_snake('ProgrammingLanguage')==('programming_language')"
] | [] | |
959 | Write a python function to count the number of equal numbers from three given integers. | def validity_triangle(a,b,c):
total = a + b + c
if total == 180:
return True
else:
return False | [
"assert string_length('python')==6",
"assert string_length('program')==7",
"assert string_length('language')==8"
] | [] | |
819 | Write a python function to check whether the count of divisors is even or odd. | def is_Perfect_Square(n) :
i = 1
while (i * i<= n):
if ((n % i == 0) and (n / i == i)):
return True
i = i + 1
return False | [
"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'"
] | [] | |
763 | Write a function to count alphabets,digits and special charactes in a given string. | 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 Sum_of_Inverse_Divisors(6,12) == 2",
"assert Sum_of_Inverse_Divisors(9,13) == 1.44",
"assert Sum_of_Inverse_Divisors(1,4) == 4"
] | [] | |
663 | Write a function to replace all occurrences of spaces, commas, or dots with a colon. | def count_Rotation(arr,n):
for i in range (1,n):
if (arr[i] < arr[i - 1]):
return i
return 0 | [
"assert text_uppercase_lowercase(\"AaBbGg\")==('Found a match!')",
"assert text_uppercase_lowercase(\"aA\")==('Not matched!')",
"assert text_uppercase_lowercase(\"PYTHON\")==('Not matched!')"
] | [] | |
721 | Write a function to find the minimum number of platforms required for a railway/bus station. | import math
def find_Digits(n):
if (n < 0):
return 0;
if (n <= 1):
return 1;
x = ((n * math.log10(n / math.e) + math.log10(2 * math.pi * n) /2.0));
return math.floor(x) + 1; | [
"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]"
] | [] | |
673 | Write a python function to find the largest triangle that can be inscribed in the semicircle. | import re
def text_match(text):
patterns = 'a.*?b$'
if re.search(patterns, text):
return ('Found a match!')
else:
return ('Not matched!') | [
"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"
] | [] | |
933 | Write a python function to find minimum adjacent swaps required to sort binary array. | def is_triangleexists(a,b,c):
if(a != 0 and b != 0 and c != 0 and (a + b + c)== 180):
if((a + b)>= c or (b + c)>= a or (a + c)>= b):
return True
else:
return False
else:
return False | [
"assert num_position(\"there are 70 flats in this apartment\")==10",
"assert num_position(\"every adult have 32 teeth\")==17",
"assert num_position(\"isha has 79 chocolates in her bag\")==9"
] | [] | |
912 | Write a function to replace all spaces in the given string with character * list item * list item * list item * list item '%20'. | def Split(list):
ev_li = []
for i in list:
if (i % 2 == 0):
ev_li.append(i)
return ev_li | [
"assert replace_specialchar('Python language, Programming language.')==('Python:language::Programming:language:')",
"assert replace_specialchar('a b c,d e f')==('a:b:c:d:e:f')",
"assert replace_specialchar('ram reshma,ram rahim')==('ram:reshma:ram:rahim')"
] | [] | |
750 | Write a function to get a lucid number smaller than or equal to n. | import re
def split_upperstring(text):
return (re.findall('[A-Z][^A-Z]*', text)) | [
"assert nth_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],2)==[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]",
"assert nth_nums([10,20,30],3)==([1000, 8000, 27000])",
"assert nth_nums([12,15],5)==([248832, 759375])"
] | [] | |
915 | Write a function to add two lists using map and lambda function. | def return_sum(dict):
sum = 0
for i in dict.values():
sum = sum + i
return sum | [
"assert remove_parenthesis([\"python (chrome)\"])==(\"python\")",
"assert remove_parenthesis([\"string(.abc)\"])==(\"string\")",
"assert remove_parenthesis([\"alpha(num)\"])==(\"alpha\")"
] | [] | |
652 | Write a python function to check if the string is a concatenation of another string. | def count_Set_Bits(n) :
n += 1;
powerOf2 = 2;
cnt = n // 2;
while (powerOf2 <= n) :
totalPairs = n // powerOf2;
cnt += (totalPairs // 2) * powerOf2;
if (totalPairs & 1) :
cnt += (n % powerOf2)
else :
cnt += 0
powe... | [
"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]"
] | [] | |
907 | Write a function to remove multiple spaces in a string. | def sum_Of_Primes(n):
prime = [True] * (n + 1)
p = 2
while p * p <= n:
if prime[p] == True:
i = p * 2
while i <= n:
prime[i] = False
i += p
p += 1
sum = 0
for i in range (2,n + 1):
if(prime[i]): ... | [
"assert check_alphanumeric(\"dawood@\") == 'Discard'",
"assert check_alphanumeric(\"skdmsam326\") == 'Accept'",
"assert check_alphanumeric(\"cooltricks@\") == 'Discard'"
] | [] | |
829 | Write a function to extract all the adjacent coordinates of the given coordinate tuple. | from itertools import groupby
def pack_consecutive_duplicates(list1):
return [list(group) for key, group in groupby(list1)] | [
"assert extract_elements([1, 1, 3, 4, 4, 5, 6, 7],2)==[1, 4]",
"assert extract_elements([0, 1, 2, 3, 4, 4, 4, 4, 5, 7],4)==[4]",
"assert extract_elements([0,0,0,0,0],5)==[0]"
] | [] | |
691 | Write a function to find the longest chain which can be formed from the given set of pairs. | def alternate_elements(list1):
result=[]
for item in list1[::2]:
result.append(item)
return result | [
"assert min_Num([1,2,3,4,5,6,7,8,9],9) == 1",
"assert min_Num([1,2,3,4,5,6,7,8],8) == 2",
"assert min_Num([1,2,3],3) == 2"
] | [] | |
831 | Write a function to find the product of first even and odd number of a given list. | def left_rotate(s,d):
tmp = s[d : ] + s[0 : d]
return tmp | [
"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"
] | [] | |
762 | Write a function to find the combinations of sums with tuples in the given tuple list. | def mutiple_tuple(nums):
temp = list(nums)
product = 1
for x in temp:
product *= x
return product | [
"assert get_Pairs_Count([1,1,1,1],4,2) == 6",
"assert get_Pairs_Count([1,5,7,-1,5],5,6) == 3",
"assert get_Pairs_Count([1,-2,3],3,1) == 1"
] | [] | |
974 | Write a function to divide two lists using map and lambda function. | from itertools import groupby
def consecutive_duplicates(nums):
return [key for key, group in groupby(nums)] | [
"assert remove_extra_char('**//Google Android// - 12. ') == 'GoogleAndroid12'",
"assert remove_extra_char('****//Google Flutter//*** - 36. ') == 'GoogleFlutter36'",
"assert remove_extra_char('**//Google Firebase// - 478. ') == 'GoogleFirebase478'"
] | [] | |
742 | Write a function to extract the maximum numeric value from a string by using regex. | from collections import defaultdict
def get_unique(test_list):
res = defaultdict(list)
for sub in test_list:
res[sub[1]].append(sub[0])
res = dict(res)
res_dict = dict()
for key in res:
res_dict[key] = len(list(set(res[key])))
return (str(res_dict)) | [
"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 "
] | [] | |
942 | Write a function to check if a nested list is a subset of another nested list. | def previous_palindrome(num):
for x in range(num-1,0,-1):
if str(x) == str(x)[::-1]:
return x | [
"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... | [] | |
876 | Write a python function to find the minimum number of swaps required to convert one binary string to another. | 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 first_repeated_char(\"abcabc\") == \"a\"",
"assert first_repeated_char(\"abc\") == \"None\"",
"assert first_repeated_char(\"123123\") == \"1\""
] | [] | |
643 | Write a python function to find the minimum difference between any two elements in a given array. | import math
def round_up(a, digits):
n = 10**-digits
return round(math.ceil(a / n) * n, digits) | [
"assert remove_kth_element([1,1,2,3,4,4,5,1],3)==[1, 1, 3, 4, 4, 5, 1]",
"assert remove_kth_element([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4],4)==[0, 0, 1, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4]",
"assert remove_kth_element([10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10],5)==[10,10,15,19, 18, 17, 26, 26, 1... | [] | |
901 | Write a python function to find sum of inverse of divisors. | def check_min_heap(arr, i):
if 2 * i + 2 > len(arr):
return True
left_child = (arr[i] <= arr[2 * i + 1]) and check_min_heap(arr, 2 * i + 1)
right_child = (2 * i + 2 == len(arr)) or (arr[i] <= arr[2 * i + 2]
and check_min_heap(arr, 2 * i + 2))
return l... | [
"assert heap_sort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])==[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]",
"assert heap_sort([25, 35, 22, 85, 14, 65, 75, 25, 58])==[14, 22, 25, 25, 35, 58, 65, 75, 85]",
"assert heap_sort( [7, 1, 9, 5])==[1,5,7,9]"
] | [] | |
602 | Write a python function to find sum of all prime divisors of a given number. | def rombus_perimeter(a):
perimeter=4*a
return perimeter | [
"assert concatenate_nested((3, 4), (5, 6)) == (3, 4, 5, 6)",
"assert concatenate_nested((1, 2), (3, 4)) == (1, 2, 3, 4)",
"assert concatenate_nested((4, 5), (6, 8)) == (4, 5, 6, 8)"
] | [] | |
947 | Write a function to find the most common elements and their counts of a specified text. | import math
def find_Index(n):
x = math.sqrt(2 * math.pow(10,(n - 1)));
return round(x); | [
"assert max_sub_array_sum([-2, -3, 4, -1, -2, 1, 5, -3],8) == 5",
"assert max_sub_array_sum([1, -2, 1, 1, -2, 1],6) == 2",
"assert max_sub_array_sum([-1, -2, 3, 4, 5],5) == 3"
] | [] | |
733 | 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 reverse_words(s):
return ' '.join(reversed(s.split())) | [
"assert series_sum(6)==91",
"assert series_sum(7)==140",
"assert series_sum(12)==650"
] | [] | |
893 | Write a function to find the maximum value in record list as tuple attribute in the given tuple list. | def max_run_uppercase(test_str):
cnt = 0
res = 0
for idx in range(0, len(test_str)):
if test_str[idx].isupper():
cnt += 1
else:
res = cnt
cnt = 0
if test_str[len(test_str) - 1].isupper():
res = cnt
return (res) | [
"assert swap_List([1,2,3]) == [3,2,1]",
"assert swap_List([1,2,3,4,4]) == [4,2,3,4,1]",
"assert swap_List([4,5,6]) == [6,5,4]"
] | [] | |
630 | Write a python function to count lower case letters in a given string. | def reverse_list_lists(lists):
for l in lists:
l.sort(reverse = True)
return lists | [
"assert find_closet([1, 4, 10],[2, 15, 20],[10, 12],3,3,2) == (10, 15, 10)",
"assert find_closet([20, 24, 100],[2, 19, 22, 79, 800],[10, 12, 23, 24, 119],3,5,5) == (24, 22, 23)",
"assert find_closet([2, 5, 11],[3, 16, 21],[11, 13],3,3,2) == (11, 16, 11)"
] | [] | |
737 | Write a python function to find the sum of fifth power of n natural numbers. | def chunk_tuples(test_tup, N):
res = [test_tup[i : i + N] for i in range(0, len(test_tup), N)]
return (res) | [
"assert check_str(\"annie\") == 'Valid'",
"assert check_str(\"dawood\") == 'Invalid'",
"assert check_str(\"Else\") == 'Valid'"
] | [] | |
645 | Write a function to convert a roman numeral to an integer. | 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 find_Index(2) == 4",
"assert find_Index(3) == 14",
"assert find_Index(4) == 45"
] | [] | |
845 | Write a function to perform chunking of tuples each of size n. | def min_jumps(arr, n):
jumps = [0 for i in range(n)]
if (n == 0) or (arr[0] == 0):
return float('inf')
jumps[0] = 0
for i in range(1, n):
jumps[i] = float('inf')
for j in range(i):
if (i <= j + arr[j]) and (jumps[j] != float('inf')):
jumps[i] = min(jumps[i], jumps[j] + 1)
break
return j... | [
"assert Sum(60) == 10",
"assert Sum(39) == 16",
"assert Sum(40) == 7"
] | [] | |
748 | Write a function to check whether the given string is ending with only alphanumeric characters or not using regex. | import math
def get_Pos_Of_Right_most_Set_Bit(n):
return int(math.log2(n&-n)+1)
def set_Right_most_Unset_Bit(n):
if (n == 0):
return 1
if ((n & (n + 1)) == 0):
return n
pos = get_Pos_Of_Right_most_Set_Bit(~n)
return ((1 << (pos - 1)) | n) | [
"assert left_rotate(\"python\",2) == \"thonpy\" ",
"assert left_rotate(\"bigdata\",3 ) == \"databig\" ",
"assert left_rotate(\"hadoop\",1 ) == \"adooph\" "
] | [] | |
954 | Write a function to find the nth delannoy number. | import math
def radian_degree(degree):
radian = degree*(math.pi/180)
return radian | [
"assert check_valid((True, True, True, True) ) == True",
"assert check_valid((True, False, True, True) ) == False",
"assert check_valid((True, True, True, True) ) == True"
] | [] | |
710 | Write a python function to find sum of odd factors of a number. | def sorted_dict(dict1):
sorted_dict = {x: sorted(y) for x, y in dict1.items()}
return sorted_dict | [
"assert count_Set_Bits(16) == 33",
"assert count_Set_Bits(2) == 2",
"assert count_Set_Bits(14) == 28"
] | [] | |
669 | Write a python function to get the difference between two lists. | import re
def remove_multiple_spaces(text1):
return (re.sub(' +',' ',text1)) | [
"assert sum_of_odd_Factors(30) == 24",
"assert sum_of_odd_Factors(18) == 13",
"assert sum_of_odd_Factors(2) == 1"
] | [] |
End of preview. Expand in Data Studio
edition_0891_google-research-datasets-mbpp-readymade
A Readymade by TheFactoryX
Original Dataset
Process
This dataset is a "readymade" - inspired by Marcel Duchamp's concept of taking everyday objects and recontextualizing them as art.
What we did:
- Selected the original dataset from Hugging Face
- Shuffled each column independently
- Destroyed all row-wise relationships
- 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
- 5