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 |
|---|---|---|---|---|---|
758 | Write a python function to get the last element of each sublist. | 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 text_starta_endb(\"aabbbb\")==('Found a match!')",
"assert text_starta_endb(\"aabAbbbc\")==('Not matched!')",
"assert text_starta_endb(\"accddbbjjj\")==('Not matched!')"
] | [] | |
697 | Write a function to caluclate the area of a tetrahedron. | import re
pattern = 'fox'
text = 'The quick brown fox jumps over the lazy dog.'
def find_literals(text, pattern):
match = re.search(pattern, text)
s = match.start()
e = match.end()
return (match.re.pattern, s, e) | [
"assert sort_list([(3, 4, 6, 723), (1, 2), (12345,), (134, 234, 34)] ) == '[(1, 2), (12345,), (3, 4, 6, 723), (134, 234, 34)]'",
"assert sort_list([(3, 4, 8), (1, 2), (1234335,), (1345, 234, 334)] ) == '[(1, 2), (3, 4, 8), (1234335,), (1345, 234, 334)]'",
"assert sort_list([(34, 4, 61, 723), (1, 2), (145,), (13... | [] | |
886 | Write a function to round up a number to specific digits. | 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 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"
] | [] | |
882 | Write a function to concatenate the given two tuples to a nested tuple. | def floor_Min(A,B,N):
x = max(B - 1,N)
return (A*x) // B | [
"assert count_tuplex((2, 4, 5, 6, 2, 3, 4, 4, 7),4)==3",
"assert count_tuplex((2, 4, 5, 6, 2, 3, 4, 4, 7),2)==2",
"assert count_tuplex((2, 4, 7, 7, 7, 3, 4, 4, 7),7)==4"
] | [] | |
787 | Write a python function to find nth bell number. | 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 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"
] | [] | |
681 | Write a function to remove all characters except letters and numbers using regex | def sum_positivenum(nums):
sum_positivenum = list(filter(lambda nums:nums>0,nums))
return sum(sum_positivenum) | [
"assert toggle_middle_bits(9) == 15",
"assert toggle_middle_bits(10) == 12",
"assert toggle_middle_bits(11) == 13"
] | [] | |
858 | Write a function to check if a triangle of positive area is possible with the given angles. | def count_range_in_list(li, min, max):
ctr = 0
for x in li:
if min <= x <= max:
ctr += 1
return ctr | [
"assert harmonic_sum(10)==2.9289682539682538",
"assert harmonic_sum(4)==2.083333333333333",
"assert harmonic_sum(7)==2.5928571428571425 "
] | [] | |
835 | Write a function to access dictionary key’s element by index. | def discriminant_value(x,y,z):
discriminant = (y**2) - (4*x*z)
if discriminant > 0:
return ("Two solutions",discriminant)
elif discriminant == 0:
return ("one solution",discriminant)
elif discriminant < 0:
return ("no real solution",discriminant) | [
"assert remove_nested((1, 5, 7, (4, 6), 10)) == (1, 5, 7, 10)",
"assert remove_nested((2, 6, 8, (5, 7), 11)) == (2, 6, 8, 11)",
"assert remove_nested((3, 7, 9, (6, 8), 12)) == (3, 7, 9, 12)"
] | [] | |
618 | Write a python function to check whether the given two numbers have same number of digits or not. | def mul_consecutive_nums(nums):
result = [b*a for a, b in zip(nums[:-1], nums[1:])]
return result | [
"assert count_range_in_list([10,20,30,40,40,40,70,80,99],40,100)==6",
"assert count_range_in_list(['a','b','c','d','e','f'],'a','e')==5",
"assert count_range_in_list([7,8,9,15,17,19,45],15,20)==3"
] | [] | |
874 | Write a function to find numbers divisible by m and n from a list of numbers using lambda function. | 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 is_triangleexists(50,60,70)==True",
"assert is_triangleexists(90,45,45)==True",
"assert is_triangleexists(150,30,70)==False"
] | [] | |
869 | Write a function to sort a list in increasing order by the last element in each tuple from a given list of non-empty tuples. | def alternate_elements(list1):
result=[]
for item in list1[::2]:
result.append(item)
return result | [
"assert check_Concat(\"abcabcabc\",\"abc\") == True",
"assert check_Concat(\"abcab\",\"abc\") == False",
"assert check_Concat(\"aba\",\"ab\") == False"
] | [] | |
960 | Write a function to find three closest elements from three sorted arrays. | def concatenate_nested(test_tup1, test_tup2):
res = test_tup1 + test_tup2
return (res) | [
"assert match_num('5-2345861')==True",
"assert match_num('6-2345861')==False",
"assert match_num('78910')==False"
] | [] | |
679 | Write a python function to check whether the given two arrays are equal or not. | def sort_by_dnf(arr, n):
low=0
mid=0
high=n-1
while mid <= high:
if arr[mid] == 0:
arr[low], arr[mid] = arr[mid], arr[low]
low = low + 1
mid = mid + 1
elif arr[mid] == 1:
mid = mid + 1
else:
arr[mid], arr[high] = arr[high], arr[mid]
high = high - 1
... | [
"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)"
] | [] | |
924 | Write a python function to find the last position of an element in a sorted array. | def Check_Solution(a,b,c):
if (a == c):
return ("Yes");
else:
return ("No"); | [
"assert min_of_two(10,20)==10",
"assert min_of_two(19,15)==15",
"assert min_of_two(-10,-20)==-20"
] | [] | |
622 | Write a python function to shift first element to the end of given list. | def add_tuple(test_list, test_tup):
test_list += test_tup
return (test_list) | [
"assert max_chain_length([Pair(5, 24), Pair(15, 25),Pair(27, 40), Pair(50, 60)], 4) == 3",
"assert max_chain_length([Pair(1, 2), Pair(3, 4),Pair(5, 6), Pair(7, 8)], 4) == 4",
"assert max_chain_length([Pair(19, 10), Pair(11, 12),Pair(13, 14), Pair(15, 16), Pair(31, 54)], 5) == 5"
] | [] | |
643 | Write a function to flatten the given tuple matrix into the tuple list with each tuple representing each column. | 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 sum_Of_Primes(10) == 17",
"assert sum_Of_Primes(20) == 77",
"assert sum_Of_Primes(5) == 10"
] | [] | |
813 | Write a function to find the length of the shortest string that has both str1 and str2 as subsequences. | from operator import eq
def count_same_pair(nums1, nums2):
result = sum(map(eq, nums1, nums2))
return result | [
"assert _sum([1, 2, 3]) == 6",
"assert _sum([15, 12, 13, 10]) == 50",
"assert _sum([0, 1, 2]) == 3"
] | [] | |
914 | Write a function to combine two given sorted lists using heapq module. | from collections import Counter
def second_frequent(input):
dict = Counter(input)
value = sorted(dict.values(), reverse=True)
second_large = value[1]
for (key, val) in dict.items():
if val == second_large:
return (key) | [
"assert chinese_zodiac(1997)==('Ox')",
"assert chinese_zodiac(1998)==('Tiger')",
"assert chinese_zodiac(1994)==('Dog')"
] | [] | |
756 | Write a function to count the pairs of reverse strings in the given string list. | def check_none(test_tup):
res = any(map(lambda ele: ele is None, test_tup))
return (res) | [
"assert max_run_uppercase('GeMKSForGERksISBESt') == 5",
"assert max_run_uppercase('PrECIOusMOVemENTSYT') == 6",
"assert max_run_uppercase('GooGLEFluTTER') == 4"
] | [] | |
734 | Write a python function to find the minimum sum of absolute differences of two arrays. | def remove_list_range(list1, leftrange, rigthrange):
result = [i for i in list1 if (min(i)>=leftrange and max(i)<=rigthrange)]
return result | [
"assert count_Rotation([3,2,1],3) == 1",
"assert count_Rotation([4,5,1,2,3],5) == 2",
"assert count_Rotation([7,8,9,1,2,3],6) == 3"
] | [] | |
911 | Write a python function to find sum of inverse of divisors. | from collections import OrderedDict
def remove_duplicate(string):
result = ' '.join(OrderedDict((w,w) for w in string.split()).keys())
return result | [
"assert move_num('I1love143you55three3000thousand') == 'Iloveyouthreethousand1143553000'",
"assert move_num('Avengers124Assemble') == 'AvengersAssemble124'",
"assert move_num('Its11our12path13to14see15things16do17things') == 'Itsourpathtoseethingsdothings11121314151617'"
] | [] | |
884 | Write a function to rotate a given list by specified number of items to the right direction. | def float_to_tuple(test_str):
res = tuple(map(float, test_str.split(', ')))
return (res) | [
"assert remove_spaces(\"a b c\") == \"abc\"",
"assert remove_spaces(\"1 2 3\") == \"123\"",
"assert remove_spaces(\" b c\") == \"bc\""
] | [] | |
617 | Write a function to print n-times a list using map function. | import re
def end_num(string):
text = re.compile(r".*[0-9]$")
if text.match(string):
return True
else:
return False | [
"assert ntimes_list([1, 2, 3, 4, 5, 6, 7],3)==[3, 6, 9, 12, 15, 18, 21]",
"assert ntimes_list([1, 2, 3, 4, 5, 6, 7],4)==[4, 8, 12, 16, 20, 24, 28]",
"assert ntimes_list([1, 2, 3, 4, 5, 6, 7],10)==[10, 20, 30, 40, 50, 60, 70]"
] | [] | |
916 | Write a function to sort dictionary items by tuple product of keys for the given dictionary with tuple keys. | def str_to_tuple(test_str):
res = tuple(map(int, test_str.split(', ')))
return (res) | [
"assert sort_tuple([(\"Amana\", 28), (\"Zenat\", 30), (\"Abhishek\", 29),(\"Nikhil\", 21), (\"B\", \"C\")]) == [('Abhishek', 29), ('Amana', 28), ('B', 'C'), ('Nikhil', 21), ('Zenat', 30)]",
"assert sort_tuple([(\"aaaa\", 28), (\"aa\", 30), (\"bab\", 29), (\"bb\", 21), (\"csa\", \"C\")]) == [('aa', 30), ('aaaa', 2... | [] | |
764 | Write a function to calculate the sum of all digits of the base to the specified power. | 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 first_Digit(5) == 1",
"assert first_Digit(10) == 3",
"assert first_Digit(7) == 5"
] | [] | |
825 | Write a python function to toggle bits of the number except the first and the last bit. | import re
def remove_parenthesis(items):
for item in items:
return (re.sub(r" ?\([^)]+\)", "", item)) | [
"assert rombus_area(10,20)==100",
"assert rombus_area(10,5)==25",
"assert rombus_area(4,2)==4"
] | [] | |
628 | Write a python function to print duplicants from a list of integers. | 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 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"
] | [] | |
864 | Write a function to remove duplicates from a list of lists. | import math
def first_Digit(n) :
fact = 1
for i in range(2,n + 1) :
fact = fact * i
while (fact % 10 == 0) :
fact = int(fact / 10)
while (fact >= 10) :
fact = int(fact / 10)
return math.floor(fact) | [
"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]"
] | [] | |
798 | Write a function to find the product of first even and odd number of a given list. | def is_Product_Even(arr,n):
for i in range(0,n):
if ((arr[i] & 1) == 0):
return True
return False | [
"assert reverse_list_lists([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]])==[[4, 3, 2, 1], [8, 7, 6, 5], [12, 11, 10, 9], [16, 15, 14, 13]]",
"assert reverse_list_lists([[1,2],[2,3],[3,4]])==[[2,1],[3,2],[4,3]]",
"assert reverse_list_lists([[10,20],[30,40]])==[[20,10],[40,30]]"
] | [] | |
967 | Write a function to put spaces between words starting with capital letters in a given string by using regex. | def convert(list):
s = [str(i) for i in list]
res = int("".join(s))
return (res) | [
"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... | [] | |
768 | Write a python function to find the sum of fifth power of n natural numbers. | def even_num(x):
if x%2==0:
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"
] | [] | |
915 | Write a python function to count the total set bits from 1 to n. | import sys
def find_max_val(n, x, y):
ans = -sys.maxsize
for k in range(n + 1):
if (k % x == y):
ans = max(ans, k)
return (ans if (ans >= 0 and
ans <= n) else -1) | [
"assert remove_duplic_list([\"Python\", \"Exercises\", \"Practice\", \"Solution\", \"Exercises\"])==['Python', 'Exercises', 'Practice', 'Solution']",
"assert remove_duplic_list([\"Python\", \"Exercises\", \"Practice\", \"Solution\", \"Exercises\",\"Java\"])==['Python', 'Exercises', 'Practice', 'Solution', 'Java']... | [] | |
803 | Write a function to multiply consecutive numbers of a given list. | 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 text_uppercase_lowercase(\"AaBbGg\")==('Found a match!')",
"assert text_uppercase_lowercase(\"aA\")==('Not matched!')",
"assert text_uppercase_lowercase(\"PYTHON\")==('Not matched!')"
] | [] | |
824 | Write a function to check whether the given amount has no profit and no loss | def get_key(dict):
list = []
for key in dict.keys():
list.append(key)
return list | [
"assert check_Odd_Parity(13) == True",
"assert check_Odd_Parity(21) == True",
"assert check_Odd_Parity(18) == False"
] | [] | |
964 | Write a python function to check whether the count of divisors is even or odd. | def max_sum_of_three_consecutive(arr, n):
sum = [0 for k in range(n)]
if n >= 1:
sum[0] = arr[0]
if n >= 2:
sum[1] = arr[0] + arr[1]
if n > 2:
sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2]))
for i in range(3, n):
sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1]... | [
"assert maximum_segments(7, 5, 2, 5) == 2",
"assert maximum_segments(17, 2, 1, 3) == 17",
"assert maximum_segments(18, 16, 3, 6) == 6"
] | [] | |
633 | Write a python function to find the smallest prime divisor of a number. | 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 max_of_nth([(5, 6, 7), (1, 3, 5), (8, 9, 19)], 2) == 19",
"assert max_of_nth([(6, 7, 8), (2, 4, 6), (9, 10, 20)], 1) == 10",
"assert max_of_nth([(7, 8, 9), (3, 5, 7), (10, 11, 21)], 1) == 11"
] | [] | |
897 | Write a function to find the maximum of nth column from the given tuple list. | 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 is_nonagonal(10) == 325",
"assert is_nonagonal(15) == 750",
"assert is_nonagonal(18) == 1089"
] | [] | |
899 | Write a function to check if the triangle is valid or not. | 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 floor_Max(11,10,9) == 9",
"assert floor_Max(5,7,4) == 2",
"assert floor_Max(2,2,1) == 1"
] | [] | |
929 | Write a function to calculate the geometric sum of n-1. | def Check_Vow(string, vowels):
final = [each for each in string if each in vowels]
return(len(final))
| [
"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"
] | [] | |
612 | Write a python function to find the index of an extra element present in one sorted array. | def mul_even_odd(list1):
first_even = next((el for el in list1 if el%2==0),-1)
first_odd = next((el for el in list1 if el%2!=0),-1)
return (first_even*first_odd) | [
"assert nth_super_ugly_number(12,[2,7,13,19])==32",
"assert nth_super_ugly_number(10,[2,7,13,19])==26",
"assert nth_super_ugly_number(100,[2,7,13,19])==5408"
] | [] | |
831 | Write a python function to check for even parity of a given number. | def find_platform(arr, dep, n):
arr.sort()
dep.sort()
plat_needed = 1
result = 1
i = 1
j = 0
while (i < n and j < n):
if (arr[i] <= dep[j]):
plat_needed+= 1
i+= 1
elif (arr[i] > dep[j]):
plat_needed-= 1... | [
"assert min_jumps([1, 3, 6, 1, 0, 9], 6) == 3",
"assert min_jumps([1, 3, 5, 8, 9, 2, 6, 7, 6, 8, 9], 11) == 3",
"assert min_jumps([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 11) == 10"
] | [] | |
668 | Write a python function to check whether the given strings are rotations of each other or not. | def sector_area(r,a):
pi=22/7
if a >= 360:
return None
sectorarea = (pi*r**2) * (a/360)
return sectorarea | [
"assert get_noOfways(4)==3",
"assert get_noOfways(3)==2",
"assert get_noOfways(5)==5"
] | [] | |
826 | Write a python function to calculate the sum of the numbers in a list between the indices of a specified range. | 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 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,... | [] | |
871 | Write a function to find the equilibrium index of the given array. | 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 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... | [] | |
851 | Write a python function to left rotate the string. | def geometric_sum(n):
if n < 0:
return 0
else:
return 1 / (pow(2, n)) + geometric_sum(n - 1) | [
"assert get_First_Set_Bit_Pos(12) == 3",
"assert get_First_Set_Bit_Pos(18) == 2",
"assert get_First_Set_Bit_Pos(16) == 5"
] | [] | |
961 | Write a function to pack consecutive duplicates of a given list elements into sublists. | def extract_unique(test_dict):
res = list(sorted({ele for val in test_dict.values() for ele in val}))
return res | [
"assert check_Type_Of_Triangle(1,2,3) == \"Obtuse-angled Triangle\"",
"assert check_Type_Of_Triangle(2,2,2) == \"Acute-angled Triangle\"",
"assert check_Type_Of_Triangle(1,0,1) == \"Right-angled Triangle\""
] | [] | |
832 | Write a function to generate a square matrix filled with elements from 1 to n raised to the power of 2 in spiral order. | 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 convert([1,2,3]) == 123",
"assert convert([4,5,6]) == 456",
"assert convert([7,8,9]) == 789"
] | [] | |
866 | Write a function to perfom the modulo of tuple elements in the given two tuples. | def add_dict_to_tuple(test_tup, test_dict):
test_tup = list(test_tup)
test_tup.append(test_dict)
test_tup = tuple(test_tup)
return (test_tup) | [
"assert re_arrange_tuples([(4, 3), (1, 9), (2, 10), (3, 2)], [1, 4, 2, 3]) == [(1, 9), (4, 3), (2, 10), (3, 2)]",
"assert re_arrange_tuples([(5, 4), (2, 10), (3, 11), (4, 3)], [3, 4, 2, 3]) == [(3, 11), (4, 3), (2, 10), (3, 11)]",
"assert re_arrange_tuples([(6, 3), (3, 8), (5, 7), (2, 4)], [2, 5, 3, 6]) == [... | [] | |
949 | Write a function to check for the number of jumps required of given length to reach a point of form (d, 0) from origin in a 2d plane. | 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 sort_list_last([(2, 5), (1, 2), (4, 4), (2, 3), (2, 1)])==[(2, 1), (1, 2), (2, 3), (4, 4), (2, 5)] ",
"assert sort_list_last([(9,8), (4, 7), (3,5), (7,9), (1,2)])==[(1,2), (3,5), (4,7), (9,8), (7,9)] ",
"assert sort_list_last([(20,50), (10,20), (40,40)])==[(10,20),(40,40),(20,50)] "
] | [] | |
676 | Write a function to sum a specific column of a list in a given list of lists. | INT_BITS = 32
def left_Rotate(n,d):
return (n << d)|(n >> (INT_BITS - d)) | [
"assert max_similar_indices([(2, 4), (6, 7), (5, 1)],[(5, 4), (8, 10), (8, 14)]) == [(5, 4), (8, 10), (8, 14)]",
"assert max_similar_indices([(3, 5), (7, 8), (6, 2)],[(6, 5), (9, 11), (9, 15)]) == [(6, 5), (9, 11), (9, 15)]",
"assert max_similar_indices([(4, 6), (8, 9), (7, 3)],[(7, 6), (10, 12), (10, 16)]) == ... | [] | |
782 | Write a function to find the n - cheap price items from a given dataset using heap queue algorithm. | def chinese_zodiac(year):
if (year - 2000) % 12 == 0:
sign = 'Dragon'
elif (year - 2000) % 12 == 1:
sign = 'Snake'
elif (year - 2000) % 12 == 2:
sign = 'Horse'
elif (year - 2000) % 12 == 3:
sign = 'sheep'
elif (year - 2000) % 12 == 4:
sign = 'Monkey'
elif (year - 2000) % 12 == ... | [
"assert change_date_format('2026-01-02')=='02-01-2026'",
"assert change_date_format('2021-01-04')=='04-01-2021'",
"assert change_date_format('2030-06-06')=='06-06-2030'"
] | [] | |
872 | Write a python function to set the right most unset bit. | 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 sample_nam(['sally', 'Dylan', 'rebecca', 'Diana', 'Joanne', 'keith'])==16",
"assert sample_nam([\"php\", \"res\", \"Python\", \"abcd\", \"Java\", \"aaa\"])==10",
"assert sample_nam([\"abcd\", \"Python\", \"abba\", \"aba\"])==6"
] | [] | |
875 | Write a function that matches a string that has an a followed by three 'b'. | 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_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"
] | [] | |
677 | Write a function to find palindromes in a given list of strings using lambda function. | def count_char(string,char):
count = 0
for i in range(len(string)):
if(string[i] == char):
count = count + 1
return count | [
"assert Split([1,2,3,4,5]) == [2,4]",
"assert Split([4,5,6,7,8,0,1]) == [4,6,8,0]",
"assert Split ([8,12,15,19]) == [8,12]"
] | [] | |
713 | Write a function to check whether the given ip address is valid or not using regex. | import collections as ct
def merge_dictionaries(dict1,dict2):
merged_dict = dict(ct.ChainMap({}, dict1, dict2))
return merged_dict | [
"assert get_inv_count([1, 20, 6, 4, 5], 5) == 5",
"assert get_inv_count([8, 4, 2, 1], 4) == 6",
"assert get_inv_count([3, 1, 2], 3) == 2"
] | [] | |
908 | Write a python function to find the sum of all odd natural numbers within the range l and r. | import re
def num_position(text):
for m in re.finditer("\d+", text):
return m.start() | [
"assert Sum(60) == 10",
"assert Sum(39) == 16",
"assert Sum(40) == 7"
] | [] | |
904 | Write a function to convert rgb color to hsv color. | def div_list(nums1,nums2):
result = map(lambda x, y: x / y, nums1, nums2)
return list(result) | [
"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]"
] | [] | |
660 | Write a python function to check whether the given number is odd or not using bitwise operator. | def arc_length(d,a):
pi=22/7
if a >= 360:
return None
arclength = (pi*d) * (a/360)
return arclength | [
"assert remove_negs([1,-2,3,-4]) == [1,3]",
"assert remove_negs([1,2,3,-4]) == [1,2,3]",
"assert remove_negs([4,5,-6,7,-8]) == [4,5,7]"
] | [] | |
709 | Write a python function to check if the string is a concatenation of another string. | def check_greater(test_tup1, test_tup2):
res = all(x < y for x, y in zip(test_tup1, test_tup2))
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"
] | [] | |
611 | Write a function that matches a word containing 'z', not at the start or end of the word. | def odd_position(nums):
return all(nums[i]%2==i%2 for i in range(len(nums))) | [
"assert div_of_nums([19, 65, 57, 39, 152, 639, 121, 44, 90, 190],2,4)==[ 152,44]",
"assert div_of_nums([1, 2, 3, 5, 7, 8, 10],2,5)==[10]",
"assert div_of_nums([10,15,14,13,18,12,20],10,5)==[10,20]"
] | [] | |
669 | Write a function to print the first n lucky 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 find_max_val(15, 10, 5) == 15",
"assert find_max_val(187, 10, 5) == 185",
"assert find_max_val(16, 11, 1) == 12"
] | [] | |
654 | Write a python function to find the minimum number of swaps required to convert one binary string to another. | def sum_Odd(n):
terms = (n + 1)//2
sum1 = terms * terms
return sum1
def sum_in_Range(l,r):
return sum_Odd(r) - sum_Odd(l - 1) | [
"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])"
] | [] | |
863 | Write a python function to find lcm of two positive integers. | def merge(lst):
return [list(ele) for ele in list(zip(*lst))] | [
"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... | [] | |
718 | Write a function to count the frequency of consecutive duplicate elements in a given list of numbers. | def tuple_modulo(test_tup1, test_tup2):
res = tuple(ele1 % ele2 for ele1, ele2 in zip(test_tup1, test_tup2))
return (res) | [
"assert prime_num(13)==True",
"assert prime_num(7)==True",
"assert prime_num(-1010)==False"
] | [] | |
962 | ## 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 rotate_right(list1,m,n):
result = list1[-(m):]+list1[:-(n)]
return result | [
"assert Check_Solution(2,0,-1) == \"Yes\"",
"assert Check_Solution(1,-5,6) == \"No\"",
"assert Check_Solution(2,0,2) == \"Yes\""
] | [] | |
840 | Write a function which accepts an arbitrary list and converts it to a heap using heap queue algorithm. | def nth_nums(nums,n):
nth_nums = list(map(lambda x: x ** n, nums))
return nth_nums | [
"assert count_vowels('bestinstareels') == 7",
"assert count_vowels('partofthejourneyistheend') == 12",
"assert count_vowels('amazonprime') == 5"
] | [] | |
837 | Write a python function to find sum of prime numbers between 1 to n. | def matrix_to_list(test_list):
temp = [ele for sub in test_list for ele in sub]
res = list(zip(*temp))
return (str(res)) | [
"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"
] | [] | |
638 | Write a function to return true if the given number is even else return false. | 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 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"
] | [] | |
642 | Write a function to find the nth jacobsthal number. | import re
def replace(string, char):
pattern = char + '{2,}'
string = re.sub(pattern, char, string)
return string | [
"assert Convert('python program') == ['python','program']",
"assert Convert('Data Analysis') ==['Data','Analysis']",
"assert Convert('Hadoop Training') == ['Hadoop','Training']"
] | [] | |
753 | Write a python function to access multiple elements of specified index from a given list. | 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 int_to_roman(1)==(\"I\")",
"assert int_to_roman(50)==(\"L\")",
"assert int_to_roman(4)==(\"IV\")"
] | [] | |
896 | Write a function to group the 1st elements on the basis of 2nd elements in the given tuple list. | import re
def text_match_three(text):
patterns = 'ab{3}?'
if re.search(patterns, text):
return 'Found a match!'
else:
return('Not matched!') | [
"assert (Diff([10, 15, 20, 25, 30, 35, 40], [25, 40, 35])) == [10, 20, 30, 15]",
"assert (Diff([1,2,3,4,5], [6,7,1])) == [2,3,4,5,6,7]",
"assert (Diff([1,2,3], [6,7,1])) == [2,3,6,7]"
] | [] | |
662 | Write a function to locate the left insertion point for a specified value in sorted order. | 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 move_last([1,2,3,4]) == [2,3,4,1]",
"assert move_last([2,3,4,1,5,0]) == [3,4,1,5,0,2]",
"assert move_last([5,4,3,2,1]) == [4,3,2,1,5]"
] | [] | |
856 | Write a function to extract all the adjacent coordinates of the given coordinate tuple. | def remove_even(l):
for i in l:
if i % 2 == 0:
l.remove(i)
return l | [
"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"
] | [] | |
930 | Write a function to check if the given tuples contain the k or not. | def get_median(arr1, arr2, n):
i = 0
j = 0
m1 = -1
m2 = -1
count = 0
while count < n + 1:
count += 1
if i == n:
m1 = m2
m2 = arr2[0]
break
elif j == n:
m1 = m2
m2 = arr1[0]
break
if arr1[i] <= arr2[j]:
m1 = m2
m2 = arr1[i]
... | [
"assert sum_of_odd_Factors(30) == 24",
"assert sum_of_odd_Factors(18) == 13",
"assert sum_of_odd_Factors(2) == 1"
] | [] | |
601 | Write a python function to find the length of the last word in a given string. | def check_identical(test_list1, test_list2):
res = test_list1 == test_list2
return (res) | [
"assert extract_max('100klh564abc365bg') == 564",
"assert extract_max('hello300how546mer231') == 546",
"assert extract_max('its233beenalong343journey234') == 343"
] | [] | |
613 | Write a function to find minimum of two numbers. | import re
def remove_extra_char(text1):
pattern = re.compile('[\W_]+')
return (pattern.sub('', text1)) | [
"assert rectangle_perimeter(10,20)==60",
"assert rectangle_perimeter(10,5)==30",
"assert rectangle_perimeter(4,2)==12"
] | [] | |
716 | Write a function to sort the given tuple list basis the total digits in tuple. | 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 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\"... | [] | |
678 | Write a python function to multiply all items in the list. | import re
def extract_date(url):
return re.findall(r'/(\d{4})/(\d{1,2})/(\d{1,2})/', url) | [
"assert divisible_by_digits(1,22)==[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22]",
"assert divisible_by_digits(1,15)==[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15]",
"assert divisible_by_digits(20,25)==[22, 24]"
] | [] | |
829 | Write a function to caluclate perimeter of a parallelogram. | def power_base_sum(base, power):
return sum([int(i) for i in str(pow(base, power))]) | [
"assert sum_Square(25) == True",
"assert sum_Square(24) == False",
"assert sum_Square(17) == True"
] | [] | |
667 | Write a function to increment the numeric values in the given strings by k. | def check_monthnum_number(monthnum1):
if monthnum1 == 2:
return True
else:
return False | [
"assert find_k_product([(5, 6, 7), (1, 3, 5), (8, 9, 19)], 2) == 665",
"assert find_k_product([(6, 7, 8), (2, 4, 6), (9, 10, 20)], 1) == 280",
"assert find_k_product([(7, 8, 9), (3, 5, 7), (10, 11, 21)], 0) == 210"
] | [] | |
775 | Write a python function to find the first digit in factorial of a given number. | def sum_list(lst1,lst2):
res_list = [lst1[i] + lst2[i] for i in range(len(lst1))]
return res_list | [
"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])"
] | [] | |
795 | Write a python function to find number of solutions in quadratic equation. | def sort_numeric_strings(nums_str):
result = [int(x) for x in nums_str]
result.sort()
return result | [
"assert tuple_to_set(('x', 'y', 'z') ) == {'y', 'x', 'z'}",
"assert tuple_to_set(('a', 'b', 'c') ) == {'c', 'a', 'b'}",
"assert tuple_to_set(('z', 'd', 'e') ) == {'d', 'e', 'z'}"
] | [] | |
784 | Write a function to find the product of it’s kth index in the given tuples. | def maximum_value(test_list):
res = [(key, max(lst)) for key, lst in test_list]
return (res) | [
"assert round_up(123.01247,0)==124",
"assert round_up(123.01247,1)==123.1",
"assert round_up(123.01247,2)==123.02"
] | [] | |
693 | Write a python function to interchange first and last elements in a given list. | from heapq import merge
def combine_lists(num1,num2):
combine_lists=list(merge(num1, num2))
return combine_lists | [
"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!')"
] | [] | |
702 | Write a function to count number of lists in a given list of lists and square the count. | def Extract(lst):
return [item[-1] for item in lst] | [
"assert remove_duplicate(\"Python Exercises Practice Solution Exercises\")==(\"Python Exercises Practice Solution\")",
"assert remove_duplicate(\"Python Exercises Practice Solution Python\")==(\"Python Exercises Practice Solution\")",
"assert remove_duplicate(\"Python Exercises Practice Solution Practice\")==(\... | [] | |
901 | 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. | from itertools import zip_longest, chain, tee
def exchange_elements(lst):
lst1, lst2 = tee(iter(lst), 2)
return list(chain.from_iterable(zip_longest(lst[1::2], lst[::2]))) | [
"assert count_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==25",
"assert count_list([[1, 3], [5, 7], [9, 11], [13, 15, 17]] )==16",
"assert count_list([[2, 4], [[6,8], [4,5,8]], [10, 12, 14]])==9"
] | [] | |
921 | Write a function to find whether an array is subset of another array. | def ntimes_list(nums,n):
result = map(lambda x:n*x, nums)
return list(result) | [
"assert alternate_elements([\"red\", \"black\", \"white\", \"green\", \"orange\"])==['red', 'white', 'orange']",
"assert alternate_elements([2, 0, 3, 4, 0, 2, 8, 3, 4, 2])==[2, 3, 0, 8, 4]",
"assert alternate_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1,3,5,7,9]"
] | [] | |
853 | Write a function to find if there is a triplet in the array whose sum is equal to a given value. | def count_Unset_Bits(n) :
cnt = 0;
for i in range(1,n + 1) :
temp = i;
while (temp) :
if (temp % 2 == 0) :
cnt += 1;
temp = temp // 2;
return cnt; | [
"assert decreasing_trend([-4,-3,-2,-1]) == True",
"assert decreasing_trend([1,2,3]) == True",
"assert decreasing_trend([3,2,1]) == False"
] | [] | |
830 | Write a python function to find even numbers from a mixed list. | def generate_matrix(n):
if n<=0:
return []
matrix=[row[:] for row in [[0]*n]*n]
row_st=0
row_ed=n-1
col_st=0
col_ed=n-1
current=1
while (True):
if current>n*n:
break
f... | [
"assert discriminant_value(4,8,2)==(\"Two solutions\",32)",
"assert discriminant_value(5,7,9)==(\"no real solution\",-131)",
"assert discriminant_value(0,0,9)==(\"one solution\",0)"
] | [] | |
797 | Write a python function to merge the first and last elements separately in a list of lists. | def count_Fac(n):
m = n
count = 0
i = 2
while((i * i) <= m):
total = 0
while (n % i == 0):
n /= i
total += 1
temp = 0
j = 1
while((temp + j) <= total):
temp += j
count += 1
j += 1
... | [
"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"
] | [] | |
665 | Write a function to check if the string is a valid email address or not using regex. | def substract_elements(test_tup1, test_tup2):
res = tuple(tuple(a - b for a, b in zip(tup1, tup2))
for tup1, tup2 in zip(test_tup1, test_tup2))
return (res) | [
"assert second_smallest([1, 2, -8, -2, 0, -2])==-2",
"assert second_smallest([1, 1, -0.5, 0, 2, -2, -2])==-0.5",
"assert second_smallest([2,2])==None"
] | [] | |
760 | Write a function to find the sequences of one upper case letter followed by lower case letters. | def remove_kth_element(list1, L):
return list1[:L-1] + list1[L:] | [
"assert mul_even_odd([1,3,5,7,4,1,6,8])==4",
"assert mul_even_odd([1,2,3,4,5,6,7,8,9,10])==2",
"assert mul_even_odd([1,5,7,9,10])==10"
] | [] | |
771 | Write a python function to calculate the product of all the numbers of a given tuple. | def find_Sum(arr,n):
arr.sort()
sum = arr[0]
for i in range(0,n-1):
if (arr[i] != arr[i+1]):
sum = sum + arr[i+1]
return sum | [
"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"
] | [] | |
650 | Write a function to check if any list element is present in the given list. | def is_decimal(num):
import re
dnumre = re.compile(r"""^[0-9]+(\.[0-9]{1,2})?$""")
result = dnumre.search(num)
return bool(result) | [
"assert are_Rotations(\"abc\",\"cba\") == False",
"assert are_Rotations(\"abcd\",\"cdba\") == False",
"assert are_Rotations(\"abacd\",\"cdaba\") == True"
] | [] | |
849 | Write a function to re-arrange the given tuples based on the given ordered list. | def min_of_two( x, y ):
if x < y:
return x
return y | [
"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"
] | [] | |
626 | Write a function to remove an empty tuple from a list of tuples. | def average_Even(n) :
if (n% 2!= 0) :
return ("Invalid Input")
return -1
sm = 0
count = 0
while (n>= 2) :
count = count+1
sm = sm+n
n = n-2
return sm // count | [
"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"
] | [] | |
785 | Write a function to remove similar rows from the given tuple matrix. | 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 sum_nums(2,10,11,20)==20",
"assert sum_nums(15,17,1,10)==32",
"assert sum_nums(10,15,5,30)==20"
] | [] | |
801 | Write a function to remove duplicate words from a given list of strings. | def Check_Solution(a,b,c):
if b == 0:
return ("Yes")
else:
return ("No") | [
"assert validity_triangle(60,50,90)==False",
"assert validity_triangle(45,75,60)==True",
"assert validity_triangle(30,50,100)==True"
] | [] | |
657 | Write a function to find length of the string. | def Split(list):
ev_li = []
for i in list:
if (i % 2 == 0):
ev_li.append(i)
return ev_li | [
"assert same_Length(12,1) == False",
"assert same_Length(2,2) == True",
"assert same_Length(10,20) == True"
] | [] | |
751 | Write a function to replace all occurrences of spaces, commas, or dots with a colon. | def new_tuple(test_list, test_str):
res = tuple(test_list + [test_str])
return (res) | [
"assert sorted_models([{'make':'Nokia', 'model':216, 'color':'Black'}, {'make':'Mi Max', 'model':2, 'color':'Gold'}, {'make':'Samsung', 'model': 7, 'color':'Blue'}])==[{'make': 'Nokia', 'model': 216, 'color': 'Black'}, {'make': 'Samsung', 'model': 7, 'color': 'Blue'}, {'make': 'Mi Max', 'model': 2, 'color': 'Gold'}... | [] |
End of preview. Expand in Data Studio
edition_2148_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
- 4