task_id int64 601 974 | text large_stringlengths 38 249 | code large_stringlengths 30 908 | test_list listlengths 3 3 | test_setup_code large_stringclasses 2
values | challenge_test_list listlengths 0 0 |
|---|---|---|---|---|---|
951 | Write a python function to check whether the given number can be represented by sum of two squares or not. | def add_list(nums1,nums2):
result = map(lambda x, y: x + y, nums1, nums2)
return list(result) | [
"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... | [] | |
920 | Write a function to find minimum of two numbers. | def alternate_elements(list1):
result=[]
for item in list1[::2]:
result.append(item)
return result | [
"assert get_coordinates((3, 4)) == [[2, 3], [2, 4], [2, 5], [3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5]]",
"assert get_coordinates((4, 5)) ==[[3, 4], [3, 5], [3, 6], [4, 4], [4, 5], [4, 6], [5, 4], [5, 5], [5, 6]]",
"assert get_coordinates((5, 6)) == [[4, 5], [4, 6], [4, 7], [5, 5], [5, 6], [5, 7], [6, 5], [... | [] | |
618 | Write a function to check whether the given month number contains 30 days or not. | 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 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"
] | [] | |
868 | Write a python function to count number of vowels in the string. | def listify_list(list1):
result = list(map(list,list1))
return result | [
"assert find_Extra([1,2,3,4],[1,2,3],3) == 3",
"assert find_Extra([2,4,6,8,10],[2,4,6,8],4) == 4",
"assert find_Extra([1,3,5,7,9,11],[1,3,5,7,9],5) == 5"
] | [] | |
960 | Write a python function to count the number of rotations required to generate a sorted array. | 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 most_common_elem('lkseropewdssafsdfafkpwe',3)==[('s', 4), ('e', 3), ('f', 3)] ",
"assert most_common_elem('lkseropewdssafsdfafkpwe',2)==[('s', 4), ('e', 3)]",
"assert most_common_elem('lkseropewdssafsdfafkpwe',7)==[('s', 4), ('e', 3), ('f', 3), ('k', 2), ('p', 2), ('w', 2), ('d', 2)]"
] | [] | |
853 | Write a python function to count the number of pairs whose sum is equal to ‘sum’. | 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 find_Index(2) == 4",
"assert find_Index(3) == 14",
"assert find_Index(4) == 45"
] | [] | |
903 | Write a function to find the nth jacobsthal number. | def heap_sort(arr):
heapify(arr)
end = len(arr) - 1
while end > 0:
arr[end], arr[0] = arr[0], arr[end]
shift_down(arr, 0, end - 1)
end -= 1
return arr
def heapify(arr):
start = len(arr) // 2
while start >= 0:
shift_down(arr, start, len(arr) - 1)
... | [
"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!')"
] | [] | |
826 | Write a function to find length of the subarray having maximum sum. | def are_Equal(arr1,arr2,n,m):
if (n != m):
return False
arr1.sort()
arr2.sort()
for i in range(0,n - 1):
if (arr1[i] != arr2[i]):
return False
return True | [
"assert find_max_val(15, 10, 5) == 15",
"assert find_max_val(187, 10, 5) == 185",
"assert find_max_val(16, 11, 1) == 12"
] | [] | |
655 | Write a function to find out, if the given number is abundant. | import math
def area_tetrahedron(side):
area = math.sqrt(3)*(side*side)
return area | [
"assert lower_ctr('abc') == 3",
"assert lower_ctr('string') == 6",
"assert lower_ctr('Python') == 5"
] | [] | |
632 | Write a python function to toggle bits of the number except the first and the last bit. | import heapq
def cheap_items(items,n):
cheap_items = heapq.nsmallest(n, items, key=lambda s: s['price'])
return cheap_items | [
"assert text_starta_endb(\"aabbbb\")==('Found a match!')",
"assert text_starta_endb(\"aabAbbbc\")==('Not matched!')",
"assert text_starta_endb(\"accddbbjjj\")==('Not matched!')"
] | [] | |
627 | Write a python function to remove the k'th element from a given list. | def tuple_modulo(test_tup1, test_tup2):
res = tuple(ele1 % ele2 for ele1, ele2 in zip(test_tup1, test_tup2))
return (res) | [
"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... | [] | |
771 | Write a python function to find the cube sum of first n odd natural numbers. | def Check_Solution(a,b,c):
if (a == c):
return ("Yes");
else:
return ("No"); | [
"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"
] | [] | |
637 | Write a function to find the minimum total path sum in the given triangle. | def arc_length(d,a):
pi=22/7
if a >= 360:
return None
arclength = (pi*d) * (a/360)
return arclength | [
"assert Check_Solution(2,0,2) == \"Yes\"",
"assert Check_Solution(2,-5,2) == \"Yes\"",
"assert Check_Solution(1,2,3) == \"No\""
] | [] | |
962 | Write a function to find out the second most repeated (or frequent) string in the given sequence. | def max_of_three(num1,num2,num3):
if (num1 >= num2) and (num1 >= num3):
lnum = num1
elif (num2 >= num1) and (num2 >= num3):
lnum = num2
else:
lnum = num3
return lnum | [
"assert 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'"
] | [] | |
718 | Write a python function to find the sum of all odd length subarrays. | 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 text_match_three(\"ac\")==('Not matched!')",
"assert text_match_three(\"dc\")==('Not matched!')",
"assert text_match_three(\"abbbba\")==('Found a match!')"
] | [] | |
917 | Write a function to find the maximum of similar indices in two lists of tuples. | def slope(x1,y1,x2,y2):
return (float)(y2-y1)/(x2-x1) | [
"assert end_num('abcdef')==False",
"assert end_num('abcdef7')==True",
"assert end_num('abc')==False"
] | [] | |
799 | Write a python function to calculate the sum of the numbers in a list between the indices of a specified range. | def _sum(arr):
sum=0
for i in arr:
sum = sum + i
return(sum) | [
"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... | [] | |
670 | Write a function to find ln, m lobb number. | def even_position(nums):
return all(nums[i]%2==i%2 for i in range(len(nums))) | [
"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"
] | [] | |
621 | Write a python function to count the number of distinct power of prime factor of given number. | import re
def text_match(text):
patterns = 'ab*?'
if re.search(patterns, text):
return ('Found a match!')
else:
return ('Not matched!') | [
"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]"
] | [] | |
835 | Write a function to find the maximum sum that can be formed which has no three consecutive elements present. | def find_first_occurrence(A, x):
(left, right) = (0, len(A) - 1)
result = -1
while left <= right:
mid = (left + right) // 2
if x == A[mid]:
result = mid
right = mid - 1
elif x < A[mid]:
right = mid - 1
else:
left = mi... | [
"assert count_reverse_pairs([\"julia\", \"best\", \"tseb\", \"for\", \"ailuj\"])== '2'",
"assert count_reverse_pairs([\"geeks\", \"best\", \"for\", \"skeeg\"]) == '1'",
"assert count_reverse_pairs([\"makes\", \"best\", \"sekam\", \"for\", \"rof\"]) == '2' "
] | [] | |
656 | Write a python function to remove spaces from a given string. | import math
def is_polite(n):
n = n + 1
return (int)(n+(math.log((n + math.log(n, 2)), 2))) | [
"assert find_first_occurrence([2, 5, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 1",
"assert find_first_occurrence([2, 3, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 2",
"assert find_first_occurrence([2, 4, 1, 5, 6, 6, 8, 9, 9, 9], 6) == 4"
] | [] | |
900 | Write a function to count the elements in a list until an element is a tuple. | def get_item(tup1,index):
item = tup1[index]
return item | [
"assert toggle_middle_bits(9) == 15",
"assert toggle_middle_bits(10) == 12",
"assert toggle_middle_bits(11) == 13"
] | [] | |
877 | Write a function to sum elements in two lists. | def reverse_Array_Upto_K(input, k):
return (input[k-1::-1] + input[k:]) | [
"assert is_abundant(12)==True",
"assert is_abundant(13)==False",
"assert is_abundant(9)==False"
] | [] | |
841 | Write a python function to find the last position of an element in a sorted array. | import math
def sum_series(number):
total = 0
total = math.pow((number * (number + 1)) /2, 2)
return total | [
"assert group_element([(6, 5), (2, 7), (2, 5), (8, 7), (9, 8), (3, 7)]) == {5: [6, 2], 7: [2, 8, 3], 8: [9]}",
"assert group_element([(7, 6), (3, 8), (3, 6), (9, 8), (10, 9), (4, 8)]) == {6: [7, 3], 8: [3, 9, 4], 9: [10]}",
"assert group_element([(8, 7), (4, 9), (4, 7), (10, 9), (11, 10), (5, 9)]) == {7: [8, 4]... | [] | |
955 | Write a function to multiply two lists using map and lambda function. | import re
def extract_max(input):
numbers = re.findall('\d+',input)
numbers = map(int,numbers)
return max(numbers) | [
"assert get_noOfways(4)==3",
"assert get_noOfways(3)==2",
"assert get_noOfways(5)==5"
] | [] | |
701 | Write a function to convert tuple string to integer tuple. | 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 wind_chill(120,35)==40",
"assert wind_chill(40,70)==86",
"assert wind_chill(10,100)==116"
] | [] | |
690 | Write a function to reverse words 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 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'}"
] | [] | |
691 | Write a function to find the minimum number of platforms required for a railway/bus station. | def swap_List(newList):
size = len(newList)
temp = newList[0]
newList[0] = newList[size - 1]
newList[size - 1] = temp
return newList | [
"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"
] | [] | |
828 | Write a function to find the perimeter of a rombus. | def multiply_elements(test_tup):
res = tuple(i * j for i, j in zip(test_tup, test_tup[1:]))
return (res) | [
"assert number_ctr('program2bedone') == 1",
"assert number_ctr('3wonders') ==1",
"assert number_ctr('123') == 3"
] | [] | |
817 | Write a function to generate a square matrix filled with elements from 1 to n raised to the power of 2 in spiral order. | from 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 check([3,2,1,2,3,4],6) == True",
"assert check([2,1,4,5,1],5) == True",
"assert check([1,2,2,1,2,3],6) == True"
] | [] | |
888 | Write a python function to check whether an array contains only one distinct element or not. | 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 find_Min_Swaps([1,0,1,0],4) == 3",
"assert find_Min_Swaps([0,1,0],3) == 1",
"assert find_Min_Swaps([0,0,1,1,0],5) == 2"
] | [] | |
745 | Write a function to find the nth nonagonal number. | from itertools import combinations
def find_combinations(test_list):
res = [(b1 + a1, b2 + a2) for (a1, a2), (b1, b2) in combinations(test_list, 2)]
return (res) | [
"assert 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]"
] | [] | |
689 | Write a function to replace all spaces in the given string with character * list item * list item * list item * list item '%20'. | import re
text = 'Python Exercises'
def replace_spaces(text):
text =text.replace (" ", "_")
return (text)
text =text.replace ("_", " ")
return (text) | [
"assert Check_Solution(2,5,2) == \"2 solutions\"",
"assert Check_Solution(1,1,1) == \"No solutions\"",
"assert Check_Solution(1,2,1) == \"1 solution\""
] | [] | |
605 | Write a function to count number of lists in a given list of lists and square the count. | def test_three_equal(x,y,z):
result= set([x,y,z])
if len(result)==3:
return 0
else:
return (4-len(result)) | [
"assert check_Even_Parity(10) == True",
"assert check_Even_Parity(11) == False",
"assert check_Even_Parity(18) == True"
] | [] | |
780 | Write a python function to set the right most unset bit. | def nth_nums(nums,n):
nth_nums = list(map(lambda x: x ** n, nums))
return nth_nums | [
"assert text_match_zero_one(\"ac\")==('Found a match!')",
"assert text_match_zero_one(\"dc\")==('Not matched!')",
"assert text_match_zero_one(\"abbbba\")==('Found a match!')"
] | [] | |
824 | Write a function to substract the elements of the given nested tuples. | import re
def extract_date(url):
return re.findall(r'/(\d{4})/(\d{1,2})/(\d{1,2})/', url) | [
"assert rombus_area(10,20)==100",
"assert rombus_area(10,5)==25",
"assert rombus_area(4,2)==4"
] | [] | |
916 | Write a function to find the combinations of sums with tuples in the given tuple list. | def return_sum(dict):
sum = 0
for i in dict.values():
sum = sum + i
return sum | [
"assert even_num(13.5)==False",
"assert even_num(0)==True",
"assert even_num(-9)==False"
] | [] | |
936 | Write a function where a string will start with a specific number. | from collections import Counter
def anagram_lambda(texts,str):
result = list(filter(lambda x: (Counter(str) == Counter(x)), texts))
return result | [
"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... | [] | |
721 | Write a python function to find the sum of all odd natural numbers within the range l and r. | def remove_length(test_str, K):
temp = test_str.split()
res = [ele for ele in temp if len(ele) != K]
res = ' '.join(res)
return (res) | [
"assert 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"
] | [] | |
674 | Write a function to find numbers divisible by m or n from a list of numbers using lambda function. | def noprofit_noloss(actual_cost,sale_amount):
if(sale_amount == actual_cost):
return True
else:
return False | [
"assert previous_palindrome(99)==88",
"assert previous_palindrome(1221)==1111",
"assert previous_palindrome(120)==111"
] | [] | |
937 | Write a python function to move all zeroes to the end of the given list. | 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 max_sum_of_three_consecutive([100, 1000, 100, 1000, 1], 5) == 2101",
"assert max_sum_of_three_consecutive([3000, 2000, 1000, 3, 10], 5) == 5013",
"assert max_sum_of_three_consecutive([1, 2, 3, 4, 5, 6, 7, 8], 8) == 27"
] | [] | |
864 | Write a function to remove consecutive duplicates of a given list. | def remove_spaces(str1):
str1 = str1.replace(' ','')
return str1 | [
"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"
] | [] | |
758 | Write a function to find the nth delannoy number. | def max_of_nth(test_list, N):
res = max([sub[N] for sub in test_list])
return (res) | [
"assert remove_spaces('python program')==('python program')",
"assert remove_spaces('python programming language')==('python programming language')",
"assert remove_spaces('python program')==('python program')"
] | [] | |
854 | Write a python function to find minimum adjacent swaps required to sort binary array. | def smallest_Divisor(n):
if (n % 2 == 0):
return 2;
i = 3;
while (i*i <= n):
if (n % i == 0):
return i;
i += 2;
return n; | [
"assert min_Jumps(3,4,11)==3.5",
"assert min_Jumps(3,4,0)==0",
"assert min_Jumps(11,14,11)==1"
] | [] | |
743 | Write a function to find length of the string. | import math
def round_up(a, digits):
n = 10**-digits
return round(math.ceil(a / n) * n, digits) | [
"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"
] | [] | |
678 | Write a python function to find the last two digits in factorial of a given number. | 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 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"
] | [] | |
971 | Write a python function to add a minimum number such that the sum of array becomes even. | 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 front_and_rear((10, 4, 5, 6, 7)) == (10, 7)",
"assert front_and_rear((1, 2, 3, 4, 5)) == (1, 5)",
"assert front_and_rear((6, 7, 8, 9, 10)) == (6, 10)"
] | [] | |
658 | Write a function to print n-times a list using map function. | 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 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"
] | 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... | [] |
941 | Write a function to calculate the standard deviation. | 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 prime_num(13)==True",
"assert prime_num(7)==True",
"assert prime_num(-1010)==False"
] | [] | |
781 | Write a python function to find the minimum difference between any two elements in a given array. | 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 find_literals('The quick brown fox jumps over the lazy dog.', 'fox') == ('fox', 16, 19)",
"assert find_literals('Its been a very crazy procedure right', 'crazy') == ('crazy', 16, 21)",
"assert find_literals('Hardest choices required strongest will', 'will') == ('will', 35, 39)"
] | [] | |
953 | Write a function to convert camel case string to snake case string. | def Check_Vow(string, vowels):
final = [each for each in string if each in vowels]
return(len(final))
| [
"assert Sum(60) == 10",
"assert Sum(39) == 16",
"assert Sum(40) == 7"
] | [] | |
626 | Write a function to iterate over all pairs of consecutive items in 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 get_key({1:'python',2:'java'})==[1,2]",
"assert get_key({10:'red',20:'blue',30:'black'})==[10,20,30]",
"assert get_key({27:'language',39:'java',44:'little'})==[27,39,44]"
] | [] | |
631 | Write a function to combine two dictionaries by adding values for common keys. | from collections import OrderedDict
def remove_duplicate(string):
result = ' '.join(OrderedDict((w,w) for w in string.split()).keys())
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"
] | [] | |
744 | Write a python function to check whether a sequence of numbers has a decreasing trend or not. | import re
def remove_all_spaces(text):
return (re.sub(r'\s+', '',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)"
] | [] | |
684 | Write a function to count those characters which have vowels as their neighbors in the given string. | 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 split_upperstring(\"PythonProgramLanguage\")==['Python','Program','Language']",
"assert split_upperstring(\"PythonProgram\")==['Python','Program']",
"assert split_upperstring(\"ProgrammingLanguage\")==['Programming','Language']"
] | [] | |
694 | Write a function to extract all the adjacent coordinates of the given coordinate tuple. | def No_of_cubes(N,K):
No = 0
No = (N - K + 1)
No = pow(No, 3)
return No | [
"assert int(lobb_num(5, 3)) == 35",
"assert int(lobb_num(3, 2)) == 5",
"assert int(lobb_num(4, 2)) == 20"
] | [] | |
925 | Write a python function to left rotate the bits of a given number. | def unique_Element(arr,n):
s = set(arr)
if (len(s) == 1):
return ('YES')
else:
return ('NO') | [
"assert first_repeated_char(\"abcabc\") == \"a\"",
"assert first_repeated_char(\"abc\") == \"None\"",
"assert first_repeated_char(\"123123\") == \"1\""
] | [] | |
672 | Write a python function to print duplicants from a list of integers. | def sum_column(list1, C):
result = sum(row[C] for row in list1)
return result | [
"assert find_longest_conseq_subseq([1, 2, 2, 3], 4) == 3",
"assert find_longest_conseq_subseq([1, 9, 3, 10, 4, 20, 2], 7) == 4",
"assert find_longest_conseq_subseq([36, 41, 56, 35, 44, 33, 34, 92, 43, 32, 42], 11) == 5"
] | [] | |
653 | Write a python function to find sum of all prime divisors of a given number. | import re
def split_list(text):
return (re.findall('[A-Z][^A-Z]*', text)) | [
"assert check_element((4, 5, 7, 9, 3), [6, 7, 10, 11]) == True",
"assert check_element((1, 2, 3, 4), [4, 6, 7, 8, 9]) == True",
"assert check_element((3, 2, 1, 4, 5), [9, 8, 7, 6]) == False"
] | [] | |
880 | Write a function to calculate the height of the given binary tree. | def mul_list(nums1,nums2):
result = map(lambda x, y: x * y, nums1, nums2)
return list(result) | [
"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... | [] | |
607 | Write a function to create a new tuple from the given string and list. | 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 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]"
] | [] | |
651 | Write a function to find the product of first even and odd number of a given list. | 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 convert([1,2,3]) == 123",
"assert convert([4,5,6]) == 456",
"assert convert([7,8,9]) == 789"
] | [] | |
965 | Write a function to pack consecutive duplicates of a given list elements into sublists. | def len_log(list1):
min=len(list1[0])
for i in list1:
if len(i)<min:
min=len(i)
return min | [
"assert pair_wise([1,1,2,3,3,4,4,5])==[(1, 1), (1, 2), (2, 3), (3, 3), (3, 4), (4, 4), (4, 5)]",
"assert pair_wise([1,5,7,9,10])==[(1, 5), (5, 7), (7, 9), (9, 10)]",
"assert pair_wise([1,2,3,4,5,6,7,8,9,10])==[(1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8), (8, 9), (9, 10)]"
] | [] | |
875 | Write a function to calculate the harmonic sum of n-1. | import re
def remove_char(S):
result = re.sub('[\W_]+', '', S)
return result | [
"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'"
] | [] | |
871 | Write a function to list out the list of given strings individually using map function. | def check_monthnumber_number(monthnum3):
if(monthnum3==4 or monthnum3==6 or monthnum3==9 or monthnum3==11):
return True
else:
return False | [
"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']]"
] | [] | |
688 | Write a python function to check for odd parity of a given number. | def div_of_nums(nums,m,n):
result = list(filter(lambda x: (x % m == 0 and x % n == 0), nums))
return result | [
"assert capital_words_spaces(\"Python\") == 'Python'",
"assert capital_words_spaces(\"PythonProgrammingExamples\") == 'Python Programming Examples'",
"assert capital_words_spaces(\"GetReadyToBeCodingFreak\") == 'Get Ready To Be Coding Freak'"
] | [] | |
767 | Write a function to caluclate perimeter of a parallelogram. | def count_tuplex(tuplex,value):
count = tuplex.count(value)
return count | [
"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]"
] | [] | |
713 | Write a function to remove the parenthesis area in a string. | def roman_to_int(s):
rom_val = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
int_val = 0
for i in range(len(s)):
if i > 0 and rom_val[s[i]] > rom_val[s[i - 1]]:
int_val += rom_val[s[i]] - 2 * rom_val[s[i - 1]]
else:
... | [
"assert access_elements([2,3,8,4,7,9],[0,3,5]) == [2, 4, 9]",
"assert access_elements([1, 2, 3, 4, 5],[1,2]) == [2,3]",
"assert access_elements([1,0,2,3],[0,1]) == [1,0]"
] | [] | |
625 | Write a python function to find the minimum sum of absolute differences of two arrays. | 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 extract_max('100klh564abc365bg') == 564",
"assert extract_max('hello300how546mer231') == 546",
"assert extract_max('its233beenalong343journey234') == 343"
] | [] | |
752 | Write a function to find the minimum number of elements that should be removed such that amax-amin<=k. | def find_Min_Sum(a,b,n):
a.sort()
b.sort()
sum = 0
for i in range(n):
sum = sum + abs(a[i] - b[i])
return sum | [
"assert int_to_roman(1)==(\"I\")",
"assert int_to_roman(50)==(\"L\")",
"assert int_to_roman(4)==(\"IV\")"
] | [] | |
832 | Write a python function to check whether all the bits are within a given range 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 count_vowels('bestinstareels') == 7",
"assert count_vowels('partofthejourneyistheend') == 12",
"assert count_vowels('amazonprime') == 5"
] | [] | |
862 | Write a function which accepts an arbitrary list and converts it to a heap using heap queue algorithm. | def mul_consecutive_nums(nums):
result = [b*a for a, b in zip(nums[:-1], nums[1:])]
return result | [
"assert max_sum_list([[1,2,3], [4,5,6], [10,11,12], [7,8,9]])==[10, 11, 12] ",
"assert max_sum_list([[3,2,1], [6,5,4], [12,11,10]])==[12,11,10] ",
"assert max_sum_list([[2,3,1]])==[2,3,1] "
] | [] | |
611 | Write a function to find the n-th power of individual elements in a list using lambda function. | def div_of_nums(nums,m,n):
result = list(filter(lambda x: (x % m == 0 or x % n == 0), nums))
return result | [
"assert right_insertion([1,2,4,5],6)==4",
"assert right_insertion([1,2,4,5],3)==2",
"assert right_insertion([1,2,4,5],7)==4"
] | [] | |
742 | Write a function to check if the given expression is balanced or not. | def access_key(ditionary,key):
return list(ditionary)[key] | [
"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)"
] | [] | |
851 | Write a function to sum a specific column of a list in a given list of lists. | import re
def remove_parenthesis(items):
for item in items:
return (re.sub(r" ?\([^)]+\)", "", item)) | [
"assert replace_specialchar('Python language, Programming language.')==('Python:language::Programming:language:')",
"assert replace_specialchar('a b c,d e f')==('a:b:c:d:e:f')",
"assert replace_specialchar('ram reshma,ram rahim')==('ram:reshma:ram:rahim')"
] | [] | |
786 | Write a function that gives profit amount if the given amount has profit else return none. | import re
def remove_spaces(text):
return (re.sub(' +',' ',text)) | [
"assert Convert('python program') == ['python','program']",
"assert Convert('Data Analysis') ==['Data','Analysis']",
"assert Convert('Hadoop Training') == ['Hadoop','Training']"
] | [] | |
682 | Write a function to find maximum run of uppercase characters in the given string. | def sum_positivenum(nums):
sum_positivenum = list(filter(lambda nums:nums>0,nums))
return sum(sum_positivenum) | [
"assert check_str(\"annie\") == 'Valid'",
"assert check_str(\"dawood\") == 'Invalid'",
"assert check_str(\"Else\") == 'Valid'"
] | [] | |
911 | Write a function to find the second smallest number in a list. | INT_BITS = 32
def left_Rotate(n,d):
return (n << d)|(n >> (INT_BITS - d)) | [
"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): ... | [] | |
706 | Write a python function to reverse an array upto a given position. | 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 text_match(\"aabbbbd\") == 'Not matched!'",
"assert text_match(\"aabAbbbc\") == 'Not matched!'",
"assert text_match(\"accddbbjjjb\") == 'Found a match!'"
] | [] | |
912 | Write a function to check if two lists of tuples are identical or not. | def is_odd(n) :
if (n^1 == n-1) :
return True;
else :
return False; | [
"assert sorted_dict({'n1': [2, 3, 1], 'n2': [5, 1, 2], 'n3': [3, 2, 4]})=={'n1': [1, 2, 3], 'n2': [1, 2, 5], 'n3': [2, 3, 4]}",
"assert sorted_dict({'n1': [25,37,41], 'n2': [41,54,63], 'n3': [29,38,93]})=={'n1': [25, 37, 41], 'n2': [41, 54, 63], 'n3': [29, 38, 93]}",
"assert sorted_dict({'n1': [58,44,56], 'n2':... | [] | |
969 | Write a python function to find the slope of a line. | 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 same_Length(12,1) == False",
"assert same_Length(2,2) == True",
"assert same_Length(10,20) == True"
] | [] | |
616 | Write a function to find the maximum of nth column from the given tuple list. | def set_middle_bits(n):
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
return (n >> 1) ^ 1
def toggle_middle_bits(n):
if (n == 1):
return 1
return n ^ set_middle_bits(n) | [
"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"
] | [] | |
904 | Write a function to count the number of unique lists within a list. | 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 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]"
] | [] | |
622 | Write a python function to find the smallest prime divisor of a number. | def coin_change(S, m, n):
table = [[0 for x in range(m)] for x in range(n+1)]
for i in range(m):
table[0][i] = 1
for i in range(1, n+1):
for j in range(m):
x = table[i - S[j]][j] if i-S[j] >= 0 else 0
y = table[i][j-1] if j >= 1 else 0
table[... | [
"assert is_triangleexists(50,60,70)==True",
"assert is_triangleexists(90,45,45)==True",
"assert is_triangleexists(150,30,70)==False"
] | [] | |
810 | Write a function to find all anagrams of a string in a given list of strings using lambda function. | def area_trapezium(base1,base2,height):
area = 0.5 * (base1 + base2) * height
return area | [
"assert rencontres_number(7, 2) == 924",
"assert rencontres_number(3, 0) == 2",
"assert rencontres_number(3, 1) == 3"
] | [] | |
804 | Write a python function to get the last element of each sublist. | def max_of_two( x, y ):
if x > y:
return x
return y | [
"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)]"
] | [] | |
827 | Write a function to find the previous palindrome of a specified number. | import re
def road_rd(street):
return (re.sub('Road$', 'Rd.', street)) | [
"assert count_even([1, 2, 3, 5, 7, 8, 9, 10])==3",
"assert count_even([10,15,14,13,-18,12,-20])==5",
"assert count_even([1, 2, 4, 8, 9])==3"
] | [] | |
727 | Write a function to find the list in a list of lists whose sum of elements is the highest. | import itertools
def remove_duplicate(list1):
list.sort(list1)
remove_duplicate = list(list1 for list1,_ in itertools.groupby(list1))
return remove_duplicate | [
"assert maximum_product( [12, 74, 9, 50, 61, 41])==225700",
"assert maximum_product([25, 35, 22, 85, 14, 65, 75, 25, 58])==414375",
"assert maximum_product([18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1])==2520"
] | [] | |
910 | Write a python function to convert a string to a list. | def extract_unique(test_dict):
res = list(sorted({ele for val in test_dict.values() for ele in val}))
return res | [
"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"
] | [] | |
683 | Write a function that matches a word containing 'z', not at the start or end of the word. | def triangle_area(r) :
if r < 0 :
return -1
return r * r | [
"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"
] | [] | |
942 | Write a python function to find sum of inverse of divisors. | def check_element(test_tup, check_list):
res = False
for ele in check_list:
if ele in test_tup:
res = True
break
return (res) | [
"assert check_expression(\"{()}[{}]\") == True",
"assert check_expression(\"{()}[{]\") == False",
"assert check_expression(\"{()}[{}][]({})\") == True"
] | [] | |
652 | Write a function to convert the given tuple to a key-value dictionary using adjacent elements. | def check_min_heap(arr, i):
if 2 * i + 2 > len(arr):
return True
left_child = (arr[i] <= arr[2 * i + 1]) and check_min_heap(arr, 2 * i + 1)
right_child = (2 * i + 2 == len(arr)) or (arr[i] <= arr[2 * i + 2]
and check_min_heap(arr, 2 * i + 2))
return l... | [
"assert max_char(\"hello world\")==('l')",
"assert max_char(\"hello \")==('l')",
"assert max_char(\"python pr\")==('p')"
] | [] | |
776 | Write a function to find whether an array is subset of another array. | 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 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... | [] | |
769 | Write a python function to find number of solutions in quadratic equation. | 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 power_base_sum(2,100)==115",
"assert power_base_sum(8,10)==37",
"assert power_base_sum(8,15)==62"
] | [] | |
704 | Write a python function to sort the given string. | def rotate_right(list1,m,n):
result = list1[-(m):]+list1[:-(n)]
return result | [
"assert parallelogram_perimeter(10,20)==400",
"assert parallelogram_perimeter(15,20)==600",
"assert parallelogram_perimeter(8,9)==144"
] | [] | |
952 | Write a function to find numbers within a given range where every number is divisible by every digit it contains. | def sample_nam(sample_names):
sample_names=list(filter(lambda el:el[0].isupper() and el[1:].islower(),sample_names))
return len(''.join(sample_names)) | [
"assert consecutive_duplicates([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4 ])==[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 4]",
"assert consecutive_duplicates([10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10])==[10, 15, 19, 18, 17, 26, 17, 18, 10]",
"assert consecutive_duplicates(['a', 'a', 'b', 'c', 'd', 'd'])==['a', 'b... | [] | |
797 | Write a function to check whether the given amount has no profit and no loss | 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 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... | [] | |
761 | Write a function to sort the given array without using any sorting algorithm. the given array consists of only 0, 1, and 2. | def average_tuple(nums):
result = [sum(x) / len(x) for x in zip(*nums)]
return result | [
"assert float_to_tuple(\"1.2, 1.3, 2.3, 2.4, 6.5\") == (1.2, 1.3, 2.3, 2.4, 6.5)",
"assert float_to_tuple(\"2.3, 2.4, 5.6, 5.4, 8.9\") == (2.3, 2.4, 5.6, 5.4, 8.9)",
"assert float_to_tuple(\"0.3, 0.5, 7.8, 9.4\") == (0.3, 0.5, 7.8, 9.4)"
] | [] | |
865 | Write a function to generate all sublists of a given list. | def tuple_to_set(t):
s = set(t)
return (s) | [
"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'}... | [] | |
702 | Write a python function to check whether the given number is a perfect square or not. | def tuple_str_int(test_str):
res = tuple(int(num) for num in test_str.replace('(', '').replace(')', '').replace('...', '').split(', '))
return (res) | [
"assert count_Fac(24) == 3",
"assert count_Fac(12) == 2",
"assert count_Fac(4) == 1"
] | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.