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 |
|---|---|---|---|---|---|
692 | Write a function to find the sequences of one upper case letter followed by lower case letters. | def count_list(input_list):
return (len(input_list))**2 | [
"assert same_Length(12,1) == False",
"assert same_Length(2,2) == True",
"assert same_Length(10,20) == True"
] | [] | |
797 | Write a function to calculate the standard deviation. | import re
def remove_all_spaces(text):
return (re.sub(r'\s+', '',text)) | [
"assert prime_num(13)==True",
"assert prime_num(7)==True",
"assert prime_num(-1010)==False"
] | [] | |
954 | Write a function to find the nth jacobsthal number. | import math
def get_First_Set_Bit_Pos(n):
return math.log2(n&-n)+1 | [
"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)"
] | [] | |
644 | Write a function to iterate over all pairs of consecutive items in a given list. | 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 replace_spaces('Jumanji The Jungle') == 'Jumanji_The_Jungle'",
"assert replace_spaces('The Avengers') == 'The_Avengers'",
"assert replace_spaces('Fast and Furious') == 'Fast_and_Furious'"
] | [] | |
945 | Write a python function to convert a list of multiple integers into a single integer. | def add_list(nums1,nums2):
result = map(lambda x, y: x + y, nums1, nums2)
return list(result) | [
"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']]"
] | [] | |
949 | Write a python function to calculate the sum of the numbers in a list between the indices of a specified range. | def extract_unique(test_dict):
res = list(sorted({ele for val in test_dict.values() for ele in val}))
return res | [
"assert sd_calc([4, 2, 5, 8, 6])== 2.23606797749979",
"assert sd_calc([1,2,3,4,5,6,7])==2.160246899469287",
"assert sd_calc([5,9,10,15,6,4])==4.070217029430577"
] | [] | |
734 | Write a function to calculate the height of the given binary tree. | def fibonacci(n):
if n == 1 or n == 2:
return 1
else:
return (fibonacci(n - 1) + (fibonacci(n - 2))) | [
"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')"
] | [] | |
622 | ## 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 | import math
import sys
def sd_calc(data):
n = len(data)
if n <= 1:
return 0.0
mean, sd = avg_calc(data), 0.0
for el in data:
sd += (float(el) - mean)**2
sd = math.sqrt(sd / float(n-1))
return sd
def avg_calc(ls):
n, mean = len(ls), 0.0
if n <= 1:
ret... | [
"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]"
] | [] | |
889 | Write a function to group a sequence of key-value pairs into a dictionary of lists using collections module. | def prime_num(num):
if num >=1:
for i in range(2, num//2):
if (num % i) == 0:
return False
else:
return True
else:
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]]"
] | [] | |
705 | Write a python function to convert a string to a list. | from itertools import groupby
def pack_consecutive_duplicates(list1):
return [list(group) for key, group in groupby(list1)] | [
"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"
] | [] | |
921 | Write a function to split the given string at uppercase letters by using regex. | def sorted_dict(dict1):
sorted_dict = {x: sorted(y) for x, y in dict1.items()}
return sorted_dict | [
"assert check_min_heap([1, 2, 3, 4, 5, 6], 0) == True",
"assert check_min_heap([2, 3, 4, 5, 10, 15], 0) == True",
"assert check_min_heap([2, 10, 4, 5, 3, 15], 0) == False"
] | [] | |
830 | Write a function to locate the right insertion point for a specified value in sorted order. | def count_even(array_nums):
count_even = len(list(filter(lambda x: (x%2 == 0) , array_nums)))
return count_even | [
"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'"
] | [] | |
832 | Write a function to check if the given tuples contain the k or not. | def div_of_nums(nums,m,n):
result = list(filter(lambda x: (x % m == 0 or x % n == 0), nums))
return result | [
"assert remove_similar_row([[(4, 5), (3, 2)], [(2, 2), (4, 6)], [(3, 2), (4, 5)]] ) == {((2, 2), (4, 6)), ((3, 2), (4, 5))}",
"assert remove_similar_row([[(5, 6), (4, 3)], [(3, 3), (5, 7)], [(4, 3), (5, 6)]] ) == {((4, 3), (5, 6)), ((3, 3), (5, 7))}",
"assert remove_similar_row([[(6, 7), (5, 4)], [(4, 4), (6, 8... | [] | |
684 | Write a function to find the median of two sorted arrays of same size. | 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 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)]"
] | [] | |
841 | Write a python function to find the smallest prime divisor of a number. | def min_k(test_list, K):
res = sorted(test_list, key = lambda x: x[1])[:K]
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]"
] | [] | |
602 | Write a function to find the area of a trapezium. | from collections import OrderedDict
def remove_duplicate(string):
result = ' '.join(OrderedDict((w,w) for w in string.split()).keys())
return result | [
"assert is_polite(7) == 11",
"assert is_polite(4) == 7",
"assert is_polite(9) == 13"
] | [] | |
926 | Write a python function to get the last element of each sublist. | 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 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'"
] | [] | |
846 | Write a function to remove similar rows from the given tuple matrix. | from collections import Counter
def most_common_elem(s,a):
most_common_elem=Counter(s).most_common(a)
return most_common_elem | [
"assert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,4,6,9,1,2])==2",
"assert max_occurrences([1, 3,5, 7,1, 3,13, 15, 17,5, 7,9,1, 11])==1",
"assert max_occurrences([1, 2, 3,2, 4, 5,1, 1, 1])==1"
] | [] | |
862 | Write function to find the sum of all items in the given dictionary. | 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 cube_Sum(2) == 28",
"assert cube_Sum(3) == 153",
"assert cube_Sum(4) == 496"
] | [] | |
747 | Write a function to find the longest common subsequence for the given three string sequence. | def get_key(dict):
list = []
for key in dict.keys():
list.append(key)
return list | [
"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"
] | [] | |
962 | Write a function to calculate wind chill index. | def check_monthnum_number(monthnum1):
if monthnum1 == 2:
return True
else:
return False | [
"assert remove_tuple([(None, 2), (None, None), (3, 4), (12, 3), (None, )] ) == '[(None, 2), (3, 4), (12, 3)]'",
"assert remove_tuple([(None, None), (None, None), (3, 6), (17, 3), (None,1 )] ) == '[(3, 6), (17, 3), (None, 1)]'",
"assert remove_tuple([(1, 2), (2, None), (3, None), (24, 3), (None, None )] ) == '[(... | [] | |
806 | Write a function to remove multiple spaces in a string by using regex. | 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 text_match_three(\"ac\")==('Not matched!')",
"assert text_match_three(\"dc\")==('Not matched!')",
"assert text_match_three(\"abbbba\")==('Found a match!')"
] | [] | |
873 | Write a function to find the occurrences of n most common words in a given text. | def concatenate_nested(test_tup1, test_tup2):
res = test_tup1 + test_tup2
return (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"
] | [] | |
942 | Write a function to check whether the given key is present in the dictionary or not. | 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 even_num(13.5)==False",
"assert even_num(0)==True",
"assert even_num(-9)==False"
] | [] | |
658 | Write a function to get the length of a complex number. | 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 count_Unset_Bits(2) == 1",
"assert count_Unset_Bits(5) == 4",
"assert count_Unset_Bits(14) == 17"
] | [] | |
721 | Write a function to sort a list in a dictionary. | def arc_length(d,a):
pi=22/7
if a >= 360:
return None
arclength = (pi*d) * (a/360)
return arclength | [
"assert extract_max('100klh564abc365bg') == 564",
"assert extract_max('hello300how546mer231') == 546",
"assert extract_max('its233beenalong343journey234') == 343"
] | [] | |
842 | 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. | import datetime
def check_date(m, d, y):
try:
m, d, y = map(int, (m, d, y))
datetime.date(y, m, d)
return True
except ValueError:
return False | [
"assert add_dict_to_tuple((4, 5, 6), {\"MSAM\" : 1, \"is\" : 2, \"best\" : 3} ) == (4, 5, 6, {'MSAM': 1, 'is': 2, 'best': 3})",
"assert add_dict_to_tuple((1, 2, 3), {\"UTS\" : 2, \"is\" : 3, \"Worst\" : 4} ) == (1, 2, 3, {'UTS': 2, 'is': 3, 'Worst': 4})",
"assert add_dict_to_tuple((8, 9, 10), {\"POS\" : 3, \"is... | [] | |
667 | Write a function to calculate the discriminant value. | def sort_tuple(tup):
n = len(tup)
for i in range(n):
for j in range(n-i-1):
if tup[j][0] > tup[j + 1][0]:
tup[j], tup[j + 1] = tup[j + 1], tup[j]
return tup | [
"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)"
] | [] | |
610 | Write a function to check if any list element is present in the given list. | def nth_nums(nums,n):
nth_nums = list(map(lambda x: x ** n, nums))
return nth_nums | [
"assert length_Of_Last_Word(\"python language\") == 8",
"assert length_Of_Last_Word(\"PHP\") == 3",
"assert length_Of_Last_Word(\"\") == 0"
] | [] | |
724 | Write a function to merge two dictionaries into a single expression. | import re
def text_match_wordz_middle(text):
patterns = '\Bz\B'
if re.search(patterns, text):
return 'Found a match!'
else:
return('Not matched!') | [
"assert remove_extra_char('**//Google Android// - 12. ') == 'GoogleAndroid12'",
"assert remove_extra_char('****//Google Flutter//*** - 36. ') == 'GoogleFlutter36'",
"assert remove_extra_char('**//Google Firebase// - 478. ') == 'GoogleFirebase478'"
] | [] | |
640 | Write a python function to find the sum of fourth power of first n even natural numbers. | def remove_similar_row(test_list):
res = set(sorted([tuple(sorted(set(sub))) for sub in test_list]))
return (res) | [
"assert set_Right_most_Unset_Bit(21) == 23",
"assert set_Right_most_Unset_Bit(11) == 15",
"assert set_Right_most_Unset_Bit(15) == 15"
] | [] | |
664 | Write a python function to count the number of digits 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 find_Index(2) == 4",
"assert find_Index(3) == 14",
"assert find_Index(4) == 45"
] | [] | |
907 | Write a python function to count lower case letters in a given string. | def Split(list):
ev_li = []
for i in list:
if (i % 2 == 0):
ev_li.append(i)
return ev_li | [
"assert remove_all_spaces('python program')==('pythonprogram')",
"assert remove_all_spaces('python programming language')==('pythonprogramminglanguage')",
"assert remove_all_spaces('python program')==('pythonprogram')"
] | [] | |
729 | Write a python function to find the minimun number of subsets with distinct elements. | def remove_list_range(list1, leftrange, rigthrange):
result = [i for i in list1 if (min(i)>=leftrange and max(i)<=rigthrange)]
return result | [
"assert extract_quotation('Cortex \"A53\" Based \"multi\" tasking \"Processor\"') == ['A53', 'multi', 'Processor']",
"assert extract_quotation('Cast your \"favorite\" entertainment \"apps\"') == ['favorite', 'apps']",
"assert extract_quotation('Watch content \"4k Ultra HD\" resolution with \"HDR 10\" Support') ... | [] | |
933 | Write a function to remove all whitespaces from a string. | def unique_Element(arr,n):
s = set(arr)
if (len(s) == 1):
return ('YES')
else:
return ('NO') | [
"assert multiply_elements((1, 5, 7, 8, 10)) == (5, 35, 56, 80)",
"assert multiply_elements((2, 4, 5, 6, 7)) == (8, 20, 30, 42)",
"assert multiply_elements((12, 13, 14, 9, 15)) == (156, 182, 126, 135)"
] | [] | |
851 | Write a function to combine two given sorted lists using heapq module. | def get_inv_count(arr, n):
inv_count = 0
for i in range(n):
for j in range(i + 1, n):
if (arr[i] > arr[j]):
inv_count += 1
return inv_count | [
"assert floor_Max(11,10,9) == 9",
"assert floor_Max(5,7,4) == 2",
"assert floor_Max(2,2,1) == 1"
] | [] | |
784 | Write a python function to count the number of rotations required to generate a sorted array. | def find_First_Missing(array,start,end):
if (start > end):
return end + 1
if (start != array[start]):
return start;
mid = int((start + end) / 2)
if (array[mid] == mid):
return find_First_Missing(array,mid+1,end)
return find_First_Missing(array,start,mid) | [
"assert is_Perfect_Square(10) == False",
"assert is_Perfect_Square(36) == True",
"assert is_Perfect_Square(14) == False"
] | [] | |
616 | Write a python function to find the minimum difference between any two elements in a given array. | 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 is_decimal('123.11')==True",
"assert is_decimal('e666.86')==False",
"assert is_decimal('3.124587')==False"
] | [] | |
768 | Write a function to convert the given tuple to a key-value dictionary using adjacent elements. | import cmath
def len_complex(a,b):
cn=complex(a,b)
length=abs(cn)
return length | [
"assert max_sum_subseq([1, 2, 9, 4, 5, 0, 4, 11, 6]) == 26",
"assert max_sum_subseq([1, 2, 9, 5, 6, 0, 5, 12, 7]) == 28",
"assert max_sum_subseq([1, 3, 10, 5, 6, 0, 6, 14, 21]) == 44"
] | [] | |
931 | Write a python function to check whether the length of the word is even or not. | 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 are_Rotations(\"abc\",\"cba\") == False",
"assert are_Rotations(\"abcd\",\"cdba\") == False",
"assert are_Rotations(\"abacd\",\"cdaba\") == True"
] | [] | |
783 | Write a python function to check whether the word is present in a given sentence or not. | def factorial(start,end):
res = 1
for i in range(start,end + 1):
res *= i
return res
def sum_of_square(n):
return int(factorial(n + 1, 2 * n) /factorial(1, n)) | [
"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"
] | [] | |
937 | Write a function to extract values between quotation marks of the given string by using regex. | def lcs_of_three(X, Y, Z, m, n, o):
L = [[[0 for i in range(o+1)] for j in range(n+1)]
for k in range(m+1)]
for i in range(m+1):
for j in range(n+1):
for k in range(o+1):
if (i == 0 or j == 0 or k == 0):
L[i][j][k] = 0
elif (X[i-1] == Y[j-1] and
X[i-1] == Z[k-1]):
L[i][... | [
"assert decreasing_trend([-4,-3,-2,-1]) == True",
"assert decreasing_trend([1,2,3]) == True",
"assert decreasing_trend([3,2,1]) == False"
] | [] | |
828 | Write a function to combine two dictionaries by adding values for common keys. | 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 sum_nums(2,10,11,20)==20",
"assert sum_nums(15,17,1,10)==32",
"assert sum_nums(10,15,5,30)==20"
] | [] | |
606 | Write a function to count the most common character in a given string. | 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 clear_tuple((1, 5, 3, 6, 8)) == ()",
"assert clear_tuple((2, 1, 4 ,5 ,6)) == ()",
"assert clear_tuple((3, 2, 5, 6, 8)) == ()"
] | [] | |
663 | Write a function to replace all occurrences of spaces, commas, or dots with a colon. | def div_list(nums1,nums2):
result = map(lambda x, y: x / y, nums1, nums2)
return list(result) | [
"assert get_item((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),3)==('e')",
"assert get_item((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),-4)==('u')",
"assert get_item((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),-3)==('r')"
] | [] | |
741 | Write a python function to find sum of all prime divisors of a given number. | 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 lower_ctr('abc') == 3",
"assert lower_ctr('string') == 6",
"assert lower_ctr('Python') == 5"
] | [] | |
650 | Write a function to group the 1st elements on the basis of 2nd elements in the given tuple list. | def is_Product_Even(arr,n):
for i in range(0,n):
if ((arr[i] & 1) == 0):
return True
return False | [
"assert product_Equal(2841) == True",
"assert product_Equal(1234) == False",
"assert product_Equal(1212) == False"
] | [] | |
815 | Write a function to find the length of the longest sub-sequence such that elements in the subsequences are consecutive integers. | from collections import Counter
import re
def n_common_words(text,n):
words = re.findall('\w+',text)
n_common_words= Counter(words).most_common(n)
return list(n_common_words) | [
"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]"
] | [] | |
620 | Write a function to count unique keys for each value present in the tuple. | import re
def extract_quotation(text1):
return (re.findall(r'"(.*?)"', text1)) | [
"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])"
] | [] | |
892 | Write a python function to find number of solutions in quadratic equation. | def profit_amount(actual_cost,sale_amount):
if(actual_cost > sale_amount):
amount = actual_cost - sale_amount
return amount
else:
return None | [
"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!')"
] | [] | |
611 | Write a python function to add a minimum number such that the sum of array becomes even. | def No_of_cubes(N,K):
No = 0
No = (N - K + 1)
No = pow(No, 3)
return No | [
"assert Check_Solution(2,0,2) == \"Yes\"",
"assert Check_Solution(2,-5,2) == \"Yes\"",
"assert Check_Solution(1,2,3) == \"No\""
] | [] | |
666 | Write a function where a string will start with a specific number. | 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 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)]"
] | [] | |
960 | Write a function to convert tuple string to integer tuple. | from collections import Counter
def count_variable(a,b,c,d):
c = Counter(p=a, q=b, r=c, s=d)
return list(c.elements()) | [
"assert text_uppercase_lowercase(\"AaBbGg\")==('Found a match!')",
"assert text_uppercase_lowercase(\"aA\")==('Not matched!')",
"assert text_uppercase_lowercase(\"PYTHON\")==('Not matched!')"
] | [] | |
810 | Write a function to push all values into a heap and then pop off the smallest values one at a time. | def find_Min_Diff(arr,n):
arr = sorted(arr)
diff = 10**20
for i in range(n-1):
if arr[i+1] - arr[i] < diff:
diff = arr[i+1] - arr[i]
return diff | [
"assert profit_amount(1500,1200)==300",
"assert profit_amount(100,200)==None",
"assert profit_amount(2000,5000)==None"
] | [] | |
643 | Write a python function to check whether the given two numbers have same number of digits or not. | def sum_Of_Subarray_Prod(arr,n):
ans = 0
res = 0
i = n - 1
while (i >= 0):
incr = arr[i]*(1 + res)
ans += incr
res = incr
i -= 1
return (ans) | [
"assert check_tuples((3, 5, 6, 5, 3, 6),[3, 6, 5]) == True",
"assert check_tuples((4, 5, 6, 4, 6, 5),[4, 5, 6]) == True",
"assert check_tuples((9, 8, 7, 6, 8, 9),[9, 8, 1]) == False"
] | [] | |
963 | Write a python function to find sum of products of all possible subarrays. | from sys import maxsize
def max_sub_array_sum(a,size):
max_so_far = -maxsize - 1
max_ending_here = 0
start = 0
end = 0
s = 0
for i in range(0,size):
max_ending_here += a[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
start = s
end = i
if max_ending_here < 0:
... | [
"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... | [] | |
927 | Write a function to find minimum k records from tuple list. | def pair_OR_Sum(arr,n) :
ans = 0
for i in range(0,n) :
for j in range(i + 1,n) :
ans = ans + (arr[i] ^ arr[j])
return ans | [
"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"
] | [] | |
897 | Write a python function to check whether all the characters are same or not. | def access_elements(nums, list_index):
result = [nums[i] for i in list_index]
return result | [
"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... | [] | |
730 | Write a function to find three closest elements from three sorted arrays. | def sum_column(list1, C):
result = sum(row[C] for row in list1)
return result | [
"assert sector_area(4,45)==6.285714285714286",
"assert sector_area(9,45)==31.82142857142857",
"assert sector_area(9,360)==None"
] | [] | |
816 | Write a function to sort the given tuple list basis the total digits in tuple. | import math
def wind_chill(v,t):
windchill = 13.12 + 0.6215*t - 11.37*math.pow(v, 0.16) + 0.3965*t*math.pow(v, 0.16)
return int(round(windchill, 0)) | [
"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']... | [] | |
660 | Write a function to convert an integer into a roman numeral. | def product_Equal(n):
if n < 10:
return False
prodOdd = 1; prodEven = 1
while n > 0:
digit = n % 10
prodOdd *= digit
n = n//10
if n == 0:
break;
digit = n % 10
prodEven *= digit
n = n//10
if prodOdd == prodEv... | [
"assert (max_height(root)) == 3",
"assert (max_height(root1)) == 5 ",
"assert (max_height(root2)) == 4"
] | [] | |
737 | Write a function to convert rgb color to hsv color. | def is_decimal(num):
import re
dnumre = re.compile(r"""^[0-9]+(\.[0-9]{1,2})?$""")
result = dnumre.search(num)
return bool(result) | [
"assert Convert('python program') == ['python','program']",
"assert Convert('Data Analysis') ==['Data','Analysis']",
"assert Convert('Hadoop Training') == ['Hadoop','Training']"
] | [] | |
670 | Write a python function to find the average of even numbers till a given even number. | 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 smallest_multiple(13)==360360",
"assert smallest_multiple(2)==2",
"assert smallest_multiple(1)==1"
] | [] | |
972 | Write a function to increment the numeric values in the given strings by k. | def remove_tuple(test_list):
res = [sub for sub in test_list if not all(ele == None for ele in sub)]
return (str(res)) | [
"assert rgb_to_hsv(255, 255, 255)==(0, 0.0, 100.0)",
"assert rgb_to_hsv(0, 215, 0)==(120.0, 100.0, 84.31372549019608)",
"assert rgb_to_hsv(10, 215, 110)==(149.26829268292684, 95.34883720930233, 84.31372549019608)"
] | [] | |
720 | Write a function to find the item with maximum occurrences in a given list. | def rearrange_numbs(array_nums):
result = sorted(array_nums, key = lambda i: 0 if i == 0 else -1 / i)
return result | [
"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"
] | [] | |
621 | Write a python function to find the sum of an array. | def jacobsthal_num(n):
dp = [0] * (n + 1)
dp[0] = 0
dp[1] = 1
for i in range(2, n+1):
dp[i] = dp[i - 1] + 2 * dp[i - 2]
return dp[n] | [
"assert replace('peep','e') == 'pep'",
"assert replace('Greek','e') == 'Grek'",
"assert replace('Moon','o') == 'Mon'"
] | [] | |
779 | Write a function to find the most common elements and their counts of a specified text. | 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 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"
] | [] | |
712 | Write a function to iterate over elements repeating each as many times as its count. | 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 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\"... | [] | |
919 | Write a function to zip two given lists of lists. | from itertools import combinations
def sub_lists(my_list):
subs = []
for i in range(0, len(my_list)+1):
temp = [list(x) for x in combinations(my_list, i)]
if len(temp)>0:
subs.extend(temp)
return subs | [
"assert left_Rotate(16,2) == 64",
"assert left_Rotate(10,2) == 40",
"assert left_Rotate(99,3) == 792"
] | [] | |
725 | Write a function to find the nth super ugly number from a given prime list of size k using heap queue algorithm. | def min_Swaps(s1,s2) :
c0 = 0; c1 = 0;
for i in range(len(s1)) :
if (s1[i] == '0' and s2[i] == '1') :
c0 += 1;
elif (s1[i] == '1' and s2[i] == '0') :
c1 += 1;
result = c0 // 2 + c1 // 2;
if (c0 % 2 == 0 and c1 % 2 == 0) :
return r... | [
"assert mul_list([1, 2, 3],[4,5,6])==[4,10,18]",
"assert mul_list([1,2],[3,4])==[3,8]",
"assert mul_list([90,120],[50,70])==[4500,8400]"
] | [] | |
703 | Write a function to locate the left insertion point for a specified value in sorted order. | def sort_String(str) :
str = ''.join(sorted(str))
return (str) | [
"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']"
] | [] | |
902 | Write a python function to find the average of a list. | import math
def lateralsurface_cone(r,h):
l = math.sqrt(r * r + h * h)
LSA = math.pi * r * l
return LSA | [
"assert recur_gcd(12,14) == 2",
"assert recur_gcd(13,17) == 1",
"assert recur_gcd(9, 3) == 3"
] | [] | |
855 | Write a function to add all the numbers in a list and divide it with the length of the list. | def length_Of_Last_Word(a):
l = 0
x = a.strip()
for i in range(len(x)):
if x[i] == " ":
l = 0
else:
l += 1
return l | [
"assert check_Concat(\"abcabcabc\",\"abc\") == True",
"assert check_Concat(\"abcab\",\"abc\") == False",
"assert check_Concat(\"aba\",\"ab\") == False"
] | [] | |
857 | Write a python function to count the number of distinct power of prime factor of given number. | def check_monthnumber_number(monthnum3):
if(monthnum3==4 or monthnum3==6 or monthnum3==9 or monthnum3==11):
return True
else:
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"
] | [] | |
895 | Write a python function to toggle bits of the number except the first and the last bit. | 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 area_tetrahedron(3)==15.588457268119894",
"assert area_tetrahedron(20)==692.8203230275509",
"assert area_tetrahedron(10)==173.20508075688772"
] | [] | |
799 | Write a function to calculate the geometric sum of n-1. | def is_Word_Present(sentence,word):
s = sentence.split(" ")
for i in s:
if (i == word):
return True
return False | [
"assert equilibrium_index([1, 2, 3, 4, 1, 2, 3]) == 3",
"assert equilibrium_index([-7, 1, 5, 2, -4, 3, 0]) == 3",
"assert equilibrium_index([1, 2, 3]) == -1"
] | [] | |
877 | Write a python function to calculate the product of all the numbers of a given tuple. | def remove_spaces(str1):
str1 = str1.replace(' ','')
return str1 | [
"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"
] | [] | |
869 | Write a function to replace all spaces in the given string with character * list item * list item * list item * list item '%20'. | 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_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"
] | [] | |
704 | Write a function to check if one tuple is a subset of another tuple. | 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 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]) == [... | [] | |
886 | Write a function to get an item of a tuple. | def test_three_equal(x,y,z):
result= set([x,y,z])
if len(result)==3:
return 0
else:
return (4-len(result)) | [
"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]"
] | [] | |
601 | Write a python function to find the minimum sum of absolute differences of two arrays. | def maximum_product(nums):
import heapq
a, b = heapq.nlargest(3, nums), heapq.nsmallest(2, nums)
return max(a[0] * a[1] * a[2], a[0] * b[0] * b[1]) | [
"assert min_Jumps(3,4,11)==3.5",
"assert min_Jumps(3,4,0)==0",
"assert min_Jumps(11,14,11)==1"
] | [] | |
839 | Write a function to check if the triangle is valid or not. | def first_repeated_char(str1):
for index,c in enumerate(str1):
if str1[:index+1].count(c) > 1:
return c
return "None" | [
"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] "
] | [] | |
697 | Write a function to count coin change. | MAX=1000;
def replace_spaces(string):
string=string.strip()
i=len(string)
space_count=string.count(' ')
new_length = i + space_count*2
if new_length > MAX:
return -1
index = new_length-1
string=list(string)
for f in range(i-2, new_length-2):
string.append('0')
for j in range(i-1, 0... | [
"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"
] | [] | |
604 | Write a python function to find minimum number swaps required to make two binary strings equal. | from itertools import groupby
def group_element(test_list):
res = dict()
for key, val in groupby(sorted(test_list, key = lambda ele: ele[1]), key = lambda ele: ele[1]):
res[key] = [ele[0] for ele in val]
return (res)
| [
"assert text_match(\"aabbbbd\") == 'Not matched!'",
"assert text_match(\"aabAbbbc\") == 'Not matched!'",
"assert text_match(\"accddbbjjjb\") == 'Found a match!'"
] | [] | |
754 | Write a python function to find sum of odd factors of a number. | 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(60) == 10",
"assert Sum(39) == 16",
"assert Sum(40) == 7"
] | [] | |
686 | Write a python function to find nth bell number. | def remove_even(l):
for i in l:
if i % 2 == 0:
l.remove(i)
return l | [
"assert int_to_roman(1)==(\"I\")",
"assert int_to_roman(50)==(\"L\")",
"assert int_to_roman(4)==(\"IV\")"
] | [] | |
758 | Write a function to sort a given list of strings of numbers numerically. | 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 is_Word_Present(\"machine learning\",\"machine\") == True",
"assert is_Word_Present(\"easy\",\"fun\") == False",
"assert is_Word_Present(\"python language\",\"code\") == False"
] | [] | |
973 | Write a function to find the largest possible value of k such that k modulo x is y. | 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 series_sum(6)==91",
"assert series_sum(7)==140",
"assert series_sum(12)==650"
] | [] | |
698 | Write a python function to find minimum adjacent swaps required to sort binary array. | def Check_Solution(a,b,c):
if b == 0:
return ("Yes")
else:
return ("No") | [
"assert count_Fac(24) == 3",
"assert count_Fac(12) == 2",
"assert count_Fac(4) == 1"
] | [] | |
868 | Write a function to count repeated items of a tuple. | import re
def camel_to_snake(text):
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 count_variable(4,2,0,-2)==['p', 'p', 'p', 'p', 'q', 'q'] ",
"assert count_variable(0,1,2,3)==['q', 'r', 'r', 's', 's', 's'] ",
"assert count_variable(11,15,12,23)==['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'r', 'r',... | [] | |
964 | Write a function to convert camel case string to snake case string. | def float_to_tuple(test_str):
res = tuple(map(float, test_str.split(', ')))
return (res) | [
"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"
] | [] | |
774 | Write a function to find the longest chain which can be formed from the given set of pairs. | def power_base_sum(base, power):
return sum([int(i) for i in str(pow(base, power))]) | [
"assert parallelogram_perimeter(10,20)==400",
"assert parallelogram_perimeter(15,20)==600",
"assert parallelogram_perimeter(8,9)==144"
] | [] | |
722 | Write a function to check if the given tuple contains all valid values or not. | 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 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): ... | [] | |
915 | Write a function to sum elements in two lists. | 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 min_Swaps(\"1101\",\"1110\") == 1",
"assert min_Swaps(\"1111\",\"0100\") == \"Not Possible\"",
"assert min_Swaps(\"1110000\",\"0001101\") == 3"
] | [] | |
694 | Write a function to find the product of it’s kth index in the given tuples. | import re
def extract_max(input):
numbers = re.findall('\d+',input)
numbers = map(int,numbers)
return max(numbers) | [
"assert get_First_Set_Bit_Pos(12) == 3",
"assert get_First_Set_Bit_Pos(18) == 2",
"assert get_First_Set_Bit_Pos(16) == 5"
] | [] | |
628 | Write a function to check whether the given month name contains 31 days or not. | import collections as ct
def merge_dictionaries(dict1,dict2):
merged_dict = dict(ct.ChainMap({}, dict1, dict2))
return merged_dict | [
"assert count_Divisors(10) == \"Even\"",
"assert count_Divisors(100) == \"Odd\"",
"assert count_Divisors(125) == \"Even\""
] | [] | |
899 | Write a function to check if the given integer is a prime number. | def tuple_str_int(test_str):
res = tuple(int(num) for num in test_str.replace('(', '').replace(')', '').replace('...', '').split(', '))
return (res) | [
"assert dealnnoy_num(3, 4) == 129",
"assert dealnnoy_num(3, 3) == 63",
"assert dealnnoy_num(4, 5) == 681"
] | [] | |
957 | Write a function to round up a number to specific digits. | def is_nonagonal(n):
return int(n * (7 * n - 5) / 2) | [
"assert Check_Solution(2,0,-1) == \"Yes\"",
"assert Check_Solution(1,-5,6) == \"No\"",
"assert Check_Solution(2,0,2) == \"Yes\""
] | [] | |
683 | Write a function to find length of the string. | 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 noprofit_noloss(1500,1200)==False",
"assert noprofit_noloss(100,100)==True",
"assert noprofit_noloss(2000,5000)==False"
] | [] | |
639 | Write a function to calculate the perimeter of a regular polygon. | import math
def radian_degree(degree):
radian = degree*(math.pi/180)
return radian | [
"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)... | [] |
End of preview. Expand in Data Studio
edition_0899_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
- 6