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 |
|---|---|---|---|---|---|
644 | Write a function to count repeated items of a tuple. | 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 anagram_lambda([\"bcda\", \"abce\", \"cbda\", \"cbea\", \"adcb\"],\"abcd\")==['bcda', 'cbda', 'adcb']",
"assert anagram_lambda([\"recitals\",\" python\"], \"articles\" )==[\"recitals\"]",
"assert anagram_lambda([\" keep\",\" abcdef\",\" xyz\"],\" peek\")==[\" keep\"]"
] | [] | |
942 | Write a python function to check whether the word is present in a given sentence or not. | def swap_List(newList):
size = len(newList)
temp = newList[0]
newList[0] = newList[size - 1]
newList[size - 1] = temp
return newList | [
"assert remove_even([1,3,5,2]) == [1,3,5]",
"assert remove_even([5,6,7]) == [5,7]",
"assert remove_even([1,2,3,4]) == [1,3]"
] | [] | |
907 | 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. | 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 area_trapezium(6,9,4)==30",
"assert area_trapezium(10,20,30)==450",
"assert area_trapezium(15,25,35)==700"
] | [] | |
801 | Write a function to count occurrence of a character in a string. | def count_Char(str,x):
count = 0
for i in range(len(str)):
if (str[i] == x) :
count += 1
n = 10
repititions = n // len(str)
count = count * repititions
l = n % len(str)
for i in range(l):
if (str[i] == x):
count += 1
return... | [
"assert is_abundant(12)==True",
"assert is_abundant(13)==False",
"assert is_abundant(9)==False"
] | [] | |
761 | Write a function to remove duplicate words from a given list of strings. | 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 triangle_area(0) == 0",
"assert triangle_area(-1) == -1",
"assert triangle_area(2) == 4"
] | [] | |
838 | Write a function to extract year, month and date from a url by using regex. | def validity_triangle(a,b,c):
total = a + b + c
if total == 180:
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 )] ) == '[(... | [] | |
899 | Write a python function to check whether a sequence of numbers has an increasing trend or not. | def return_sum(dict):
sum = 0
for i in dict.values():
sum = sum + i
return sum | [
"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"
] | [] | |
765 | Write a python function to check for odd parity 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 remove_spaces('python program')==('python program')",
"assert remove_spaces('python programming language')==('python programming language')",
"assert remove_spaces('python program')==('python program')"
] | [] | |
685 | Write a function to sort a list of dictionaries using lambda function. | def is_key_present(d,x):
if x in d:
return True
else:
return False | [
"assert remove_extra_char('**//Google Android// - 12. ') == 'GoogleAndroid12'",
"assert remove_extra_char('****//Google Flutter//*** - 36. ') == 'GoogleFlutter36'",
"assert remove_extra_char('**//Google Firebase// - 478. ') == 'GoogleFirebase478'"
] | [] | |
692 | Write a function to find the area of a trapezium. | def increasing_trend(nums):
if (sorted(nums)== nums):
return True
else:
return False | [
"assert sum_Of_Subarray_Prod([1,2,3],3) == 20",
"assert sum_Of_Subarray_Prod([1,2],2) == 5",
"assert sum_Of_Subarray_Prod([1,2,3,4],4) == 84"
] | [] | |
828 | Write a function to print the first n lucky numbers. | def is_nonagonal(n):
return int(n * (7 * n - 5) / 2) | [
"assert merge_dictionaries({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" }, { \"G\": \"Green\", \"W\": \"White\" })=={'B': 'Black', 'R': 'Red', 'P': 'Pink', 'G': 'Green', 'W': 'White'}",
"assert merge_dictionaries({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" },{ \"O\": \"Orange\", \"W\": \"White\", \... | [] | |
617 | Write a python function to find minimum possible value for the given periodic function. | 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 remove_all_spaces('python program')==('pythonprogram')",
"assert remove_all_spaces('python programming language')==('pythonprogramminglanguage')",
"assert remove_all_spaces('python program')==('pythonprogram')"
] | [] | |
839 | Write a function to remove similar rows from the given tuple matrix. | def all_Bits_Set_In_The_Given_Range(n,l,r):
num = ((1 << r) - 1) ^ ((1 << (l - 1)) - 1)
new_num = n & num
if (num == new_num):
return True
return False | [
"assert find_platform([900, 940, 950, 1100, 1500, 1800],[910, 1200, 1120, 1130, 1900, 2000],6)==3",
"assert find_platform([100,200,300,400],[700,800,900,1000],4)==4",
"assert find_platform([5,6,7,8],[4,3,2,1],4)==1"
] | [] | |
636 | Write a function to find n-th rencontres number. | 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 series_sum(6)==91",
"assert series_sum(7)==140",
"assert series_sum(12)==650"
] | [] | |
626 | Write a function to check if each element of the second tuple is greater than its corresponding index in the first tuple. | 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 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"
] | [] | |
866 | Write a function to count the most common character in a given string. | def front_and_rear(test_tup):
res = (test_tup[0], test_tup[-1])
return (res) | [
"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])"
] | [] | |
618 | Write a function to calculate the geometric sum of n-1. | 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 remove_duplicate([[10, 20], [40], [30, 56, 25], [10, 20], [33], [40]])==[[10, 20], [30, 56, 25], [33], [40]] ",
"assert remove_duplicate([\"a\", \"b\", \"a\", \"c\", \"c\"] )==[\"a\", \"b\", \"c\"]",
"assert remove_duplicate([1, 3, 5, 6, 3, 5, 6, 1] )==[1, 3, 5, 6]"
] | [] | |
666 | Write a python function to sort the given string. | def max_occurrences(list1):
max_val = 0
result = list1[0]
for i in list1:
occu = list1.count(i)
if occu > max_val:
max_val = occu
result = i
return result | [
"assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},5)==True",
"assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},6)==True",
"assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},10)==False"
] | [] | |
698 | Write a python function to find sum of prime numbers between 1 to n. | from collections import Counter
def most_common_elem(s,a):
most_common_elem=Counter(s).most_common(a)
return most_common_elem | [
"assert smallest_multiple(13)==360360",
"assert smallest_multiple(2)==2",
"assert smallest_multiple(1)==1"
] | [] | |
602 | Write a python function to count lower case letters in a given string. | def move_zero(num_list):
a = [0 for i in range(num_list.count(0))]
x = [ i for i in num_list if i != 0]
x.extend(a)
return (x) | [
"assert sector_area(4,45)==6.285714285714286",
"assert sector_area(9,45)==31.82142857142857",
"assert sector_area(9,360)==None"
] | [] | |
915 | Write a function to convert rgb color to hsv color. | def lower_ctr(str):
lower_ctr= 0
for i in range(len(str)):
if str[i] >= 'a' and str[i] <= 'z': lower_ctr += 1
return lower_ctr | [
"assert check_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"
] | [] | |
675 | Write a python function to reverse an array upto a given position. | 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 product_Equal(2841) == True",
"assert product_Equal(1234) == False",
"assert product_Equal(1212) == False"
] | [] | |
857 | Write a python function to find sum of inverse of divisors. | 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 tuple_str_int(\"(7, 8, 9)\") == (7, 8, 9)",
"assert tuple_str_int(\"(1, 2, 3)\") == (1, 2, 3)",
"assert tuple_str_int(\"(4, 5, 6)\") == (4, 5, 6)"
] | [] | |
712 | Write a python function to find the smallest missing number from the given array. | def get_item(tup1,index):
item = tup1[index]
return item | [
"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]"
] | [] | |
944 | Write a function to find maximum of three numbers. | 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 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)"
] | [] | |
787 | Write a python function to merge the first and last elements separately in a list of lists. | def find_triplet_array(A, arr_size, sum):
for i in range( 0, arr_size-2):
for j in range(i + 1, arr_size-1):
for k in range(j + 1, arr_size):
if A[i] + A[j] + A[k] == sum:
return A[i],A[j],A[k]
return True
return False | [
"assert is_upper(\"person\") ==\"PERSON\"",
"assert is_upper(\"final\") == \"FINAL\"",
"assert is_upper(\"Valid\") == \"VALID\""
] | [] | |
722 | Write a function to find the maximum value in record list as tuple attribute in the given tuple list. | 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 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)]) == ... | [] | |
799 | Write a python function to find the minimum difference between any two elements in a given array. | def check_valid(test_tup):
res = not any(map(lambda ele: not ele, test_tup))
return (res) | [
"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"
] | [] | |
800 | Write a python function to find the sum of all even natural numbers within the range l and r. | 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 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"
] | [] | |
865 | Write a python function to check whether the given two numbers have same number of digits or not. | def odd_Num_Sum(n) :
j = 0
sm = 0
for i in range(1,n + 1) :
j = (2*i-1)
sm = sm + (j*j*j*j)
return sm | [
"assert odd_Num_Sum(2) == 82",
"assert odd_Num_Sum(3) == 707",
"assert odd_Num_Sum(4) == 3108"
] | [] | |
669 | Write a function to find the fixed point in the given array. | import re
def remove_char(S):
result = re.sub('[\W_]+', '', S)
return result | [
"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"
] | [] | |
825 | Write a function to remove all tuples with all none values in the given tuple list. | 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 is_Word_Present(\"machine learning\",\"machine\") == True",
"assert is_Word_Present(\"easy\",\"fun\") == False",
"assert is_Word_Present(\"python language\",\"code\") == False"
] | [] | |
912 | Write a python function to replace multiple occurence of character by single. | class Pair(object):
def __init__(self, a, b):
self.a = a
self.b = b
def max_chain_length(arr, n):
max = 0
mcl = [1 for i in range(n)]
for i in range(1, n):
for j in range(0, i):
if (arr[i].a > arr[j].b and
mcl[i] < mcl[j] + 1):
mcl[i] = mcl[j] + 1
for i in range(n):
if (ma... | [
"assert listify_list(['Red', 'Blue', 'Black', 'White', 'Pink'])==[['R', 'e', 'd'], ['B', 'l', 'u', 'e'], ['B', 'l', 'a', 'c', 'k'], ['W', 'h', 'i', 't', 'e'], ['P', 'i', 'n', 'k']]",
"assert listify_list(['python'])==[['p', 'y', 't', 'h', 'o', 'n']]",
"assert listify_list([' red ', 'green',' black', 'blue ',' o... | [] | |
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. | def mul_consecutive_nums(nums):
result = [b*a for a, b in zip(nums[:-1], nums[1:])]
return result | [
"assert Check_Solution(2,0,-1) == \"Yes\"",
"assert Check_Solution(1,-5,6) == \"No\"",
"assert Check_Solution(2,0,2) == \"Yes\""
] | [] | |
814 | Write a python function to find the cube sum of first n odd natural numbers. | 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 sum_positivenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==48",
"assert sum_positivenum([10,15,-14,13,-18,12,-20])==50",
"assert sum_positivenum([19, -65, 57, 39, 152,-639, 121, 44, 90, -190])==522"
] | [] | |
703 | Write a function to find ln, m lobb number. | def check_identical(test_list1, test_list2):
res = test_list1 == test_list2
return (res) | [
"assert find_Digits(7) == 4",
"assert find_Digits(5) == 3",
"assert find_Digits(4) == 2"
] | [] | |
896 | 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 find_fixed_point(arr, n):
for i in range(n):
if arr[i] is i:
return i
return -1 | [
"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]"
] | [] | |
918 | Write a function to filter the height and width of students which are stored in a dictionary. | def clear_tuple(test_tup):
temp = list(test_tup)
temp.clear()
test_tup = tuple(temp)
return (test_tup) | [
"assert sort_by_dnf([1,2,0,1,0,1,2,1,1], 9) == [0, 0, 1, 1, 1, 1, 1, 2, 2]",
"assert sort_by_dnf([1,0,0,1,2,1,2,2,1,0], 10) == [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]",
"assert sort_by_dnf([2,2,1,0,0,0,1,1,2,1], 10) == [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]"
] | [] | |
727 | Write a python function to check if roots of a quadratic equation are reciprocal of each other or not. | 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 find_combinations([(2, 4), (6, 7), (5, 1), (6, 10)]) == [(8, 11), (7, 5), (8, 14), (11, 8), (12, 17), (11, 11)]",
"assert find_combinations([(3, 5), (7, 8), (6, 2), (7, 11)]) == [(10, 13), (9, 7), (10, 16), (13, 10), (14, 19), (13, 13)]",
"assert find_combinations([(4, 6), (8, 9), (7, 3), (8, 12)]) == [... | [] | |
970 | Write a python function to find minimum adjacent swaps required to sort binary array. | import re
def text_starta_endb(text):
patterns = 'a.*?b$'
if re.search(patterns, text):
return 'Found a match!'
else:
return('Not matched!') | [
"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"
] | [] | |
641 | Write a function to sort dictionary items by tuple product of keys for the given dictionary with tuple keys. | def multiply_list(items):
tot = 1
for x in items:
tot *= x
return tot | [
"assert max_run_uppercase('GeMKSForGERksISBESt') == 5",
"assert max_run_uppercase('PrECIOusMOVemENTSYT') == 6",
"assert max_run_uppercase('GooGLEFluTTER') == 4"
] | [] | |
935 | Write a function to find out the second most repeated (or frequent) string in the given sequence. | 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 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]]"
] | [] | |
671 | Write a python function to check whether an array can be sorted or not by picking only the corner elements. | 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 coin_change([1, 2, 3],3,4)==4",
"assert coin_change([4,5,6,7,8,9],6,9)==2",
"assert coin_change([4,5,6,7,8,9],6,4)==1"
] | [] | |
950 | Write a function to reverse each list in a given list of lists. | def maximum_value(test_list):
res = [(key, max(lst)) for key, lst in test_list]
return (res) | [
"assert find_triplet_array([1, 4, 45, 6, 10, 8], 6, 22) == (4, 10, 8)",
"assert find_triplet_array([12, 3, 5, 2, 6, 9], 6, 24) == (12, 3, 9)",
"assert find_triplet_array([1, 2, 3, 4, 5], 5, 9) == (1, 3, 5)"
] | [] | |
965 | Write a function to check whether the given month number contains 28 days or not. | def extract_index_list(l1, l2, l3):
result = []
for m, n, o in zip(l1, l2, l3):
if (m == n == o):
result.append(m)
return result | [
"assert last([1,2,3],1,3) == 0",
"assert last([1,1,1,2,3,4],1,6) == 2",
"assert last([2,3,2,3,6,8,9],3,8) == 3"
] | [] | |
724 | Write a function to convert an integer into a roman numeral. | def area_trapezium(base1,base2,height):
area = 0.5 * (base1 + base2) * height
return area | [
"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"
] | [] | |
745 | Write a python function to count the number of rotations required to generate a sorted array. | 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 sum_Even(2,5) == 6",
"assert sum_Even(3,8) == 18",
"assert sum_Even(4,6) == 10"
] | [] | |
757 | Write a function to check for a number at the end of a string. | def sum_Square(n) :
i = 1
while i*i <= n :
j = 1
while (j*j <= n) :
if (i*i+j*j == n) :
return True
j = j+1
i = i+1
return False | [
"assert find_Index(2) == 4",
"assert find_Index(3) == 14",
"assert find_Index(4) == 45"
] | [] | |
951 | Write a function to convert degrees to radians. | 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 occurance_substring('python programming, python language','python')==('python', 0, 6)",
"assert occurance_substring('python programming,programming language','programming')==('programming', 7, 18)",
"assert occurance_substring('python programming,programming language','language')==('language', 31, 39)"
... | [] | |
681 | Write a function to find the nth super ugly number from a given prime list of size k using heap queue algorithm. | 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 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]"
] | [] | |
760 | Write a python function to calculate the product of all the numbers of a given 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 super_seq(\"AGGTAB\", \"GXTXAYB\", 6, 7) == 9",
"assert super_seq(\"feek\", \"eke\", 4, 3) == 5",
"assert super_seq(\"PARRT\", \"RTA\", 5, 3) == 6"
] | [] | |
639 | Write a python function to count the number of lists in a given number of lists. | def sum_nums(x, y,m,n):
sum_nums= x + y
if sum_nums in range(m, n):
return 20
else:
return sum_nums | [
"assert check_Concat(\"abcabcabc\",\"abc\") == True",
"assert check_Concat(\"abcab\",\"abc\") == False",
"assert check_Concat(\"aba\",\"ab\") == False"
] | [] | |
759 | Write a function to remove multiple spaces in a string. | 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 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"
] | [] | |
929 | Write a function that gives profit amount if the given amount has profit else return none. | def remove_spaces(str1):
str1 = str1.replace(' ','')
return str1 | [
"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... | [] | |
780 | Write a function to check if the given expression is balanced or not. | 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 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\""
] | [] | |
651 | Write a python function to check whether the two given strings are isomorphic to each other or not. | def sum_num(numbers):
total = 0
for x in numbers:
total += x
return total/len(numbers) | [
"assert slope(4,2,2,5) == -1.5",
"assert slope(2,4,4,6) == 1",
"assert slope(1,2,4,2) == 0"
] | [] | |
664 | Write a function to check whether the given month number contains 30 days 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 string_length('python')==6",
"assert string_length('program')==7",
"assert string_length('language')==8"
] | [] | |
864 | Write a function to find the longest chain which can be formed from the given set of pairs. | 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 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"
] | [] | |
775 | Write a python function to convert the given string to upper case. | def parallelogram_perimeter(b,h):
perimeter=2*(b*h)
return perimeter | [
"assert match_num('5-2345861')==True",
"assert match_num('6-2345861')==False",
"assert match_num('78910')==False"
] | [] | |
833 | Write a python function to check whether the product of digits of a number at even and odd places is equal or not. | def reverse_words(s):
return ' '.join(reversed(s.split())) | [
"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"
] | [] | |
720 | Write a python function to find sum of all prime divisors of a given number. | 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 is_decimal('123.11')==True",
"assert is_decimal('e666.86')==False",
"assert is_decimal('3.124587')==False"
] | [] | |
843 | Write a function to find the smallest multiple of the first n numbers. | import re
def text_match_zero_one(text):
patterns = 'ab?'
if re.search(patterns, text):
return 'Found a match!'
else:
return('Not matched!') | [
"assert average_tuple(((10, 10, 10, 12), (30, 45, 56, 45), (81, 80, 39, 32), (1, 2, 3, 4)))==[30.5, 34.25, 27.0, 23.25]",
"assert average_tuple(((1, 1, -5), (30, -15, 56), (81, -60, -39), (-10, 2, 3)))== [25.5, -18.0, 3.75]",
"assert average_tuple( ((100, 100, 100, 120), (300, 450, 560, 450), (810, 800, 390, 32... | [] | |
905 | Write a python function to count the number of equal numbers from three given integers. | import heapq as hq
def heap_sort(iterable):
h = []
for value in iterable:
hq.heappush(h, value)
return [hq.heappop(h) for i in range(len(h))] | [
"assert Odd_Length_Sum([1,2,4]) == 14",
"assert Odd_Length_Sum([1,2,1,2]) == 15",
"assert Odd_Length_Sum([1,7]) == 8"
] | [] | |
851 | Write a function to check whether the given month name contains 31 days or not. | def rectangle_perimeter(l,b):
perimeter=2*(l+b)
return perimeter | [
"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]"
] | [] | |
883 | Write a function to count the number of unique lists within a list. | import math
def is_polite(n):
n = n + 1
return (int)(n+(math.log((n + math.log(n, 2)), 2))) | [
"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"
] | [] | |
614 | Write a function to split the given string at uppercase letters by using regex. | def Split(list):
ev_li = []
for i in list:
if (i % 2 == 0):
ev_li.append(i)
return ev_li | [
"assert count_Char(\"abcac\",'a') == 4",
"assert count_Char(\"abca\",'c') == 2",
"assert count_Char(\"aba\",'a') == 7"
] | [] | |
624 | Write a python function to multiply all items in the list. | 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 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)"
] | [] | |
926 | Write a function to convert the given string of float type into tuple. | import re
def remove_multiple_spaces(text1):
return (re.sub(' +',' ',text1)) | [
"assert heap_sort([12, 2, 4, 5, 2, 3]) == [2, 2, 3, 4, 5, 12]",
"assert heap_sort([32, 14, 5, 6, 7, 19]) == [5, 6, 7, 14, 19, 32]",
"assert heap_sort([21, 15, 29, 78, 65]) == [15, 21, 29, 65, 78]"
] | [] | |
783 | Write a python function to find the last position of an element in a sorted array. | 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 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"
] | [] | |
678 | Write a function to re-arrange the given tuples based on the given ordered list. | import re
def check_substring(string, sample) :
if (sample in string):
y = "\A" + sample
x = re.search(y, string)
if x :
return ("string starts with the given substring")
else :
return ("string doesnt start with the given substring")
else :
retur... | [
"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)]"
] | [] | |
880 | Write a python function to find lcm of two positive integers. | def last(n):
return n[-1]
def sort_list_last(tuples):
return sorted(tuples, key=last) | [
"assert prime_num(13)==True",
"assert prime_num(7)==True",
"assert prime_num(-1010)==False"
] | [] | |
788 | Write a function to extract all the adjacent coordinates of the given coordinate tuple. | def min_Swaps(str1,str2) :
count = 0
for i in range(len(str1)) :
if str1[i] != str2[i] :
count += 1
if count % 2 == 0 :
return (count // 2)
else :
return ("Not Possible") | [
"assert sum_Range_list([2, 1, 5, 6, 8, 3, 4, 9, 10, 11, 8, 12],8,10) == 29",
"assert sum_Range_list([1,2,3,4,5],1,2) == 5",
"assert sum_Range_list([1,0,1,2,5,6],4,5) == 11"
] | [] | |
609 | Write a function to remove the nested record from the given tuple. | def number_ctr(str):
number_ctr= 0
for i in range(len(str)):
if str[i] >= '0' and str[i] <= '9': number_ctr += 1
return number_ctr | [
"assert remove_parenthesis([\"python (chrome)\"])==(\"python\")",
"assert remove_parenthesis([\"string(.abc)\"])==(\"string\")",
"assert remove_parenthesis([\"alpha(num)\"])==(\"alpha\")"
] | [] | |
737 | Write a function to find the length of the longest sub-sequence such that elements in the subsequences are consecutive integers. | def max_similar_indices(test_list1, test_list2):
res = [(max(x[0], y[0]), max(x[1], y[1]))
for x, y in zip(test_list1, test_list2)]
return (res) | [
"assert geometric_sum(7) == 1.9921875",
"assert geometric_sum(4) == 1.9375",
"assert geometric_sum(8) == 1.99609375"
] | [] | |
898 | Write a python function to convert a list of multiple integers into a single integer. | import re
def text_match(text):
patterns = 'a.*?b$'
if re.search(patterns, text):
return ('Found a match!')
else:
return ('Not matched!') | [
"assert remove_empty([(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')])==[('',), ('a', 'b'), ('a', 'b', 'c'), 'd'] ",
"assert remove_empty([(), (), ('',), (\"python\"), (\"program\")])==[('',), (\"python\"), (\"program\")] ",
"assert remove_empty([(), (), ('',), (\"java\")])==[('',),(\"java\") ] "
] | root = Node(1)
root.left = Node(2)
root.right = Node(3)
root.left.left = Node(4)
root.left.right = Node(5)
root1 = Node(1);
root1.left = Node(2);
root1.right = Node(3);
root1.left.left = Node(4);
root1.right.left = Node(5);
root1.right.right = Node(6);
root1.right.right.right= Node(7);
ro... | [] |
605 | Write a python function to get the position of rightmost set bit. | def is_decimal(num):
import re
dnumre = re.compile(r"""^[0-9]+(\.[0-9]{1,2})?$""")
result = dnumre.search(num)
return bool(result) | [
"assert maximum_segments(7, 5, 2, 5) == 2",
"assert maximum_segments(17, 2, 1, 3) == 17",
"assert maximum_segments(18, 16, 3, 6) == 6"
] | [] | |
816 | Write a function to check if two lists of tuples are identical or not. | def sum_column(list1, C):
result = sum(row[C] for row in list1)
return result | [
"assert sum_Square(25) == True",
"assert sum_Square(24) == False",
"assert sum_Square(17) == True"
] | [] | |
734 | Write a python function to count numeric values in a given string. | def mul_list(nums1,nums2):
result = map(lambda x, y: x * y, nums1, nums2)
return list(result) | [
"assert int_to_roman(1)==(\"I\")",
"assert int_to_roman(50)==(\"L\")",
"assert int_to_roman(4)==(\"IV\")"
] | [] | |
859 | Write a function to find palindromes in a given list of strings using lambda function. | def Sum_of_Inverse_Divisors(N,Sum):
ans = float(Sum)*1.0 /float(N);
return round(ans,2); | [
"assert remove_list_range([[2], [0], [1, 2, 3], [0, 1, 2, 3, 6, 7], [9, 11], [13, 14, 15, 17]],13,17)==[[13, 14, 15, 17]]",
"assert remove_list_range([[2], [0], [1, 2, 3], [0, 1, 2, 3, 6, 7], [9, 11], [13, 14, 15, 17]],1,3)==[[2], [1, 2, 3]]",
"assert remove_list_range([[2], [0], [1, 2, 3], [0, 1, 2, 3, 6, 7], ... | [] | |
708 | Write a function to clear the values of the given tuples. | def Convert(string):
li = list(string.split(" "))
return li | [
"assert radian_degree(90)==1.5707963267948966",
"assert radian_degree(60)==1.0471975511965976",
"assert radian_degree(120)==2.0943951023931953"
] | [] | |
888 | Write a python function to find the slope of a line. | 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 check_Even_Parity(10) == True",
"assert check_Even_Parity(11) == False",
"assert check_Even_Parity(18) == True"
] | [] | |
777 | Write a function to find the longest common subsequence for the given three string sequence. | import heapq as hq
def raw_heap(rawheap):
hq.heapify(rawheap)
return rawheap | [
"assert text_match(\"msb\") == 'Not matched!'",
"assert text_match(\"a0c\") == 'Found a match!'",
"assert text_match(\"abbc\") == 'Found a match!'"
] | [] | |
945 | Write a function to get a lucid number smaller than or equal to n. | import re
def split_list(text):
return (re.findall('[A-Z][^A-Z]*', text)) | [
"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)"
] | [] | |
768 | Write a python function to find the sum of non-repeated elements in a given array. | def remove_list_range(list1, leftrange, rigthrange):
result = [i for i in list1 if (min(i)>=leftrange and max(i)<=rigthrange)]
return result | [
"assert text_uppercase_lowercase(\"AaBbGg\")==('Found a match!')",
"assert text_uppercase_lowercase(\"aA\")==('Not matched!')",
"assert text_uppercase_lowercase(\"PYTHON\")==('Not matched!')"
] | [] | |
658 | Write a function to convert the given string of integers into a tuple. | import math
def area_tetrahedron(side):
area = math.sqrt(3)*(side*side)
return area | [
"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]"
] | [] | |
900 | Write a function to extract unique values from the given dictionary values. | def _sum(arr):
sum=0
for i in arr:
sum = sum + i
return(sum) | [
"assert Check_Solution(2,5,2) == \"2 solutions\"",
"assert Check_Solution(1,1,1) == \"No solutions\"",
"assert Check_Solution(1,2,1) == \"1 solution\""
] | [] | |
796 | Write a function to find the product of it’s kth index in the given tuples. | 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 even_num(13.5)==False",
"assert even_num(0)==True",
"assert even_num(-9)==False"
] | [] | |
785 | Write a function to calculate the sum of series 1²+2²+3²+….+n². | from itertools import groupby
def extract_elements(numbers, n):
result = [i for i, j in groupby(numbers) if len(list(j)) == n]
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"
] | [] | |
637 | Write a function to sort a list in a dictionary. | def sum_list(lst1,lst2):
res_list = [lst1[i] + lst2[i] for i in range(len(lst1))]
return res_list | [
"assert sum_in_Range(2,5) == 8",
"assert sum_in_Range(5,7) == 12",
"assert sum_in_Range(7,13) == 40"
] | [] | |
874 | Write a function to concatenate the given two tuples to a nested tuple. | def check_subset(list1,list2):
return all(map(list1.__contains__,list2)) | [
"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... | [] | |
718 | Write a function to calculate the harmonic sum of n-1. | 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')"
] | [] | |
753 | Write a function to find the maximum number of segments of lengths a, b and c that can be formed from n. | 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 move_zero([1,0,2,0,3,4]) == [1,2,3,4,0,0]",
"assert move_zero([2,3,2,0,0,4,0,5,0]) == [2,3,2,4,5,0,0,0,0]",
"assert move_zero([0,1,0,1,1]) == [1,1,1,0,0]"
] | [] | |
659 | Write a python function to count the number of distinct power of prime factor of given number. | 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 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"
] | [] | |
772 | Write a function that matches a string that has an a followed by zero or more b's. | def increment_numerics(test_list, K):
res = [str(int(ele) + K) if ele.isdigit() else ele for ele in test_list]
return res | [
"assert roman_to_int('MMMCMLXXXVI')==3986",
"assert roman_to_int('MMMM')==4000",
"assert roman_to_int('C')==100"
] | [] | |
818 | Write a python function to find the type of triangle from the given sides. | def largest_subset(a, n):
dp = [0 for i in range(n)]
dp[n - 1] = 1;
for i in range(n - 2, -1, -1):
mxm = 0;
for j in range(i + 1, n):
if a[j] % a[i] == 0 or a[i] % a[j] == 0:
mxm = max(mxm, dp[j])
dp[i] = 1 + mxm
return max(dp) | [
"assert second_frequent(['aaa','bbb','ccc','bbb','aaa','aaa']) == 'bbb'",
"assert second_frequent(['abc','bcd','abc','bcd','bcd','bcd']) == 'abc'",
"assert second_frequent(['cdma','gsm','hspa','gsm','cdma','cdma']) == 'gsm'"
] | [] | |
762 | Write a function to find maximum run of uppercase characters in the given string. | def first_odd(nums):
first_odd = next((el for el in nums if el%2!=0),-1)
return first_odd | [
"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)"
] | [] | |
752 | Write a function to check if the string is a valid email address or not using regex. | 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 fibonacci(7) == 13",
"assert fibonacci(8) == 21",
"assert fibonacci(9) == 34"
] | [] | |
625 | Write a python function to count equal element pairs from the given array. | 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 extract_date(\"https://www.washingtonpost.com/news/football-insider/wp/2016/09/02/odell-beckhams-fame-rests-on-one-stupid-little-ball-josh-norman-tells-author/\") == [('2016', '09', '02')]",
"assert extract_date(\"https://www.indiatoday.in/movies/celebrities/story/wp/2020/11/03/odeof-sushant-singh-rajput-... | [] | |
749 | Write a function to get the length of a complex number. | 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 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... | [] | |
622 | Write a function to find the index of the first occurrence of a given number in a sorted array. | 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 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): ... | [] |
End of preview. Expand in Data Studio
edition_0653_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