question_title
stringlengths
7
8
question_content
stringlengths
37
191
question_id
stringlengths
2
3
contest_id
stringclasses
1 value
test_id
int64
0
5
contest_date
timestamp[us]
starter_code
stringlengths
37
1.33k
function_name
stringlengths
3
32
difficulty
stringclasses
1 value
test
stringlengths
57
1.94k
Mbpp_252
Write a python function to convert complex numbers to polar coordinates.
252
mbpp
0
2024-11-26T21:40:54.279495
import cmath def convert(numbers): num = cmath.polar(numbers) return (num)
convert
easy
[{"input": "1", "output": "(1.0, 0.0)", "testtype": "functional"}]
Mbpp_252
Write a python function to convert complex numbers to polar coordinates.
252
mbpp
1
2024-11-26T21:40:54.279604
import cmath def convert(numbers): num = cmath.polar(numbers) return (num)
convert
easy
[{"input": "4", "output": "(4.0,0.0)", "testtype": "functional"}]
Mbpp_252
Write a python function to convert complex numbers to polar coordinates.
252
mbpp
2
2024-11-26T21:40:54.279746
import cmath def convert(numbers): num = cmath.polar(numbers) return (num)
convert
easy
[{"input": "5", "output": "(5.0,0.0)", "testtype": "functional"}]
Mbpp_253
Write a python function to count integers from a given list.
253
mbpp
0
2024-11-26T21:40:54.279930
def count_integer(list1): ctr = 0 for i in list1: if isinstance(i, int): ctr = ctr + 1 return ctr
count_integer
easy
[{"input": "[1,2,'abc',1.2]", "output": "2", "testtype": "functional"}]
Mbpp_253
Write a python function to count integers from a given list.
253
mbpp
1
2024-11-26T21:40:54.280097
def count_integer(list1): ctr = 0 for i in list1: if isinstance(i, int): ctr = ctr + 1 return ctr
count_integer
easy
[{"input": "[1,2,3]", "output": "3", "testtype": "functional"}]
Mbpp_253
Write a python function to count integers from a given list.
253
mbpp
2
2024-11-26T21:40:54.280272
def count_integer(list1): ctr = 0 for i in list1: if isinstance(i, int): ctr = ctr + 1 return ctr
count_integer
easy
[{"input": "[1,1.2,4,5.1]", "output": "2", "testtype": "functional"}]
Mbpp_254
Write a function to find all words starting with 'a' or 'e' in a given string.
254
mbpp
0
2024-11-26T21:40:54.280454
import re def words_ae(text): list = re.findall("[ae]\w+", text) return list
words_ae
easy
[{"input": "\"python programe\"", "output": "['ame']", "testtype": "functional"}]
Mbpp_254
Write a function to find all words starting with 'a' or 'e' in a given string.
254
mbpp
1
2024-11-26T21:40:54.280587
import re def words_ae(text): list = re.findall("[ae]\w+", text) return list
words_ae
easy
[{"input": "\"python programe language\"", "output": "['ame','anguage']", "testtype": "functional"}]
Mbpp_254
Write a function to find all words starting with 'a' or 'e' in a given string.
254
mbpp
2
2024-11-26T21:40:54.280725
import re def words_ae(text): list = re.findall("[ae]\w+", text) return list
words_ae
easy
[{"input": "\"assert statement\"", "output": "['assert', 'atement']", "testtype": "functional"}]
Mbpp_255
Write a function to choose specified number of colours from three different colours and generate all the combinations with repetitions.
255
mbpp
0
2024-11-26T21:40:54.280857
from itertools import combinations_with_replacement def combinations_colors(l, n): return list(combinations_with_replacement(l,n))
combinations_colors
easy
[{"input": " [\"Red\",\"Green\",\"Blue\"],1", "output": "[('Red',), ('Green',), ('Blue',)]", "testtype": "functional"}]
Mbpp_255
Write a function to choose specified number of colours from three different colours and generate all the combinations with repetitions.
255
mbpp
1
2024-11-26T21:40:54.280972
from itertools import combinations_with_replacement def combinations_colors(l, n): return list(combinations_with_replacement(l,n))
combinations_colors
easy
[{"input": " [\"Red\",\"Green\",\"Blue\"],2", "output": "[('Red', 'Red'), ('Red', 'Green'), ('Red', 'Blue'), ('Green', 'Green'), ('Green', 'Blue'), ('Blue', 'Blue')]", "testtype": "functional"}]
Mbpp_255
Write a function to choose specified number of colours from three different colours and generate all the combinations with repetitions.
255
mbpp
2
2024-11-26T21:40:54.281082
from itertools import combinations_with_replacement def combinations_colors(l, n): return list(combinations_with_replacement(l,n))
combinations_colors
easy
[{"input": " [\"Red\",\"Green\",\"Blue\"],3", "output": "[('Red', 'Red', 'Red'), ('Red', 'Red', 'Green'), ('Red', 'Red', 'Blue'), ('Red', 'Green', 'Green'), ('Red', 'Green', 'Blue'), ('Red', 'Blue', 'Blue'), ('Green', 'Green', 'Green'), ('Green', 'Green', 'Blue'), ('Green', 'Blue', 'Blue'), ('Blue', 'Blue', 'Blue')]", "testtype": "functional"}]
Mbpp_256
Write a python function to count the number of prime numbers less than a given non-negative number.
256
mbpp
0
2024-11-26T21:40:54.281349
def count_Primes_nums(n): ctr = 0 for num in range(n): if num <= 1: continue for i in range(2,num): if (num % i) == 0: break else: ctr += 1 return ctr
count_Primes_nums
easy
[{"input": "5", "output": "2", "testtype": "functional"}]
Mbpp_256
Write a python function to count the number of prime numbers less than a given non-negative number.
256
mbpp
1
2024-11-26T21:40:54.281606
def count_Primes_nums(n): ctr = 0 for num in range(n): if num <= 1: continue for i in range(2,num): if (num % i) == 0: break else: ctr += 1 return ctr
count_Primes_nums
easy
[{"input": "10", "output": "4", "testtype": "functional"}]
Mbpp_256
Write a python function to count the number of prime numbers less than a given non-negative number.
256
mbpp
2
2024-11-26T21:40:54.281861
def count_Primes_nums(n): ctr = 0 for num in range(n): if num <= 1: continue for i in range(2,num): if (num % i) == 0: break else: ctr += 1 return ctr
count_Primes_nums
easy
[{"input": "100", "output": "25", "testtype": "functional"}]
Mbpp_257
Write a function to swap two numbers.
257
mbpp
0
2024-11-26T21:40:54.282603
def swap_numbers(a,b): temp = a a = b b = temp return (a,b)
swap_numbers
easy
[{"input": "10,20", "output": "(20,10)", "testtype": "functional"}]
Mbpp_257
Write a function to swap two numbers.
257
mbpp
1
2024-11-26T21:40:54.282828
def swap_numbers(a,b): temp = a a = b b = temp return (a,b)
swap_numbers
easy
[{"input": "15,17", "output": "(17,15)", "testtype": "functional"}]
Mbpp_257
Write a function to swap two numbers.
257
mbpp
2
2024-11-26T21:40:54.282994
def swap_numbers(a,b): temp = a a = b b = temp return (a,b)
swap_numbers
easy
[{"input": "100,200", "output": "(200,100)", "testtype": "functional"}]
Mbpp_258
Write a function to find number of odd elements in the given list using lambda function.
258
mbpp
0
2024-11-26T21:40:54.283199
def count_odd(array_nums): count_odd = len(list(filter(lambda x: (x%2 != 0) , array_nums))) return count_odd
count_odd
easy
[{"input": "[1, 2, 3, 5, 7, 8, 10]", "output": "4", "testtype": "functional"}]
Mbpp_258
Write a function to find number of odd elements in the given list using lambda function.
258
mbpp
1
2024-11-26T21:40:54.283384
def count_odd(array_nums): count_odd = len(list(filter(lambda x: (x%2 != 0) , array_nums))) return count_odd
count_odd
easy
[{"input": "[10,15,14,13,-18,12,-20]", "output": "2", "testtype": "functional"}]
Mbpp_258
Write a function to find number of odd elements in the given list using lambda function.
258
mbpp
2
2024-11-26T21:40:54.283577
def count_odd(array_nums): count_odd = len(list(filter(lambda x: (x%2 != 0) , array_nums))) return count_odd
count_odd
easy
[{"input": "[1, 2, 4, 8, 9]", "output": "2", "testtype": "functional"}]
Mbpp_259
Write a function to maximize the given two tuples.
259
mbpp
0
2024-11-26T21:40:54.283864
def maximize_elements(test_tup1, test_tup2): res = tuple(tuple(max(a, b) for a, b in zip(tup1, tup2)) for tup1, tup2 in zip(test_tup1, test_tup2)) return (res)
maximize_elements
easy
[{"input": "((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))", "output": "((6, 7), (4, 9), (2, 9), (7, 10))", "testtype": "functional"}]
Mbpp_259
Write a function to maximize the given two tuples.
259
mbpp
1
2024-11-26T21:40:54.284130
def maximize_elements(test_tup1, test_tup2): res = tuple(tuple(max(a, b) for a, b in zip(tup1, tup2)) for tup1, tup2 in zip(test_tup1, test_tup2)) return (res)
maximize_elements
easy
[{"input": "((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))", "output": "((7, 8), (5, 10), (3, 10), (8, 11))", "testtype": "functional"}]
Mbpp_259
Write a function to maximize the given two tuples.
259
mbpp
2
2024-11-26T21:40:54.284380
def maximize_elements(test_tup1, test_tup2): res = tuple(tuple(max(a, b) for a, b in zip(tup1, tup2)) for tup1, tup2 in zip(test_tup1, test_tup2)) return (res)
maximize_elements
easy
[{"input": "((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))", "output": "((8, 9), (6, 11), (4, 11), (9, 12))", "testtype": "functional"}]
Mbpp_260
Write a function to find the nth newman–shanks–williams prime number.
260
mbpp
0
2024-11-26T21:40:54.284605
def newman_prime(n): if n == 0 or n == 1: return 1 return 2 * newman_prime(n - 1) + newman_prime(n - 2)
newman_prime
easy
[{"input": "3", "output": "7", "testtype": "functional"}]
Mbpp_260
Write a function to find the nth newman–shanks–williams prime number.
260
mbpp
1
2024-11-26T21:40:54.289028
def newman_prime(n): if n == 0 or n == 1: return 1 return 2 * newman_prime(n - 1) + newman_prime(n - 2)
newman_prime
easy
[{"input": "4", "output": "17", "testtype": "functional"}]
Mbpp_260
Write a function to find the nth newman–shanks–williams prime number.
260
mbpp
2
2024-11-26T21:40:54.289298
def newman_prime(n): if n == 0 or n == 1: return 1 return 2 * newman_prime(n - 1) + newman_prime(n - 2)
newman_prime
easy
[{"input": "5", "output": "41", "testtype": "functional"}]
Mbpp_261
Write a function to perform mathematical division operation across the given tuples.
261
mbpp
0
2024-11-26T21:40:54.289534
def division_elements(test_tup1, test_tup2): res = tuple(ele1 // ele2 for ele1, ele2 in zip(test_tup1, test_tup2)) return (res)
division_elements
easy
[{"input": "(10, 4, 6, 9),(5, 2, 3, 3)", "output": "(2, 2, 2, 3)", "testtype": "functional"}]
Mbpp_261
Write a function to perform mathematical division operation across the given tuples.
261
mbpp
1
2024-11-26T21:40:54.289785
def division_elements(test_tup1, test_tup2): res = tuple(ele1 // ele2 for ele1, ele2 in zip(test_tup1, test_tup2)) return (res)
division_elements
easy
[{"input": "(12, 6, 8, 16),(6, 3, 4, 4)", "output": "(2, 2, 2, 4)", "testtype": "functional"}]
Mbpp_261
Write a function to perform mathematical division operation across the given tuples.
261
mbpp
2
2024-11-26T21:40:54.289969
def division_elements(test_tup1, test_tup2): res = tuple(ele1 // ele2 for ele1, ele2 in zip(test_tup1, test_tup2)) return (res)
division_elements
easy
[{"input": "(20, 14, 36, 18),(5, 7, 6, 9)", "output": "(4, 2, 6, 2)", "testtype": "functional"}]
Mbpp_262
Write a function to split a given list into two parts where the length of the first part of the list is given.
262
mbpp
0
2024-11-26T21:40:54.290110
def split_two_parts(list1, L): return list1[:L], list1[L:]
split_two_parts
easy
[{"input": "[1,1,2,3,4,4,5,1],3", "output": "([1, 1, 2], [3, 4, 4, 5, 1])", "testtype": "functional"}]
Mbpp_262
Write a function to split a given list into two parts where the length of the first part of the list is given.
262
mbpp
1
2024-11-26T21:40:54.290220
def split_two_parts(list1, L): return list1[:L], list1[L:]
split_two_parts
easy
[{"input": "['a', 'b', 'c', 'd'],2", "output": "(['a', 'b'], ['c', 'd'])", "testtype": "functional"}]
Mbpp_262
Write a function to split a given list into two parts where the length of the first part of the list is given.
262
mbpp
2
2024-11-26T21:40:54.290334
def split_two_parts(list1, L): return list1[:L], list1[L:]
split_two_parts
easy
[{"input": "['p', 'y', 't', 'h', 'o', 'n'],4", "output": "(['p', 'y', 't', 'h'], ['o', 'n'])", "testtype": "functional"}]
Mbpp_263
Write a function to merge two dictionaries.
263
mbpp
0
2024-11-26T21:40:54.290491
def merge_dict(d1,d2): d = d1.copy() d.update(d2) return d
merge_dict
easy
[{"input": "{'a': 100, 'b': 200},{'x': 300, 'y': 200}", "output": "{'x': 300, 'y': 200, 'a': 100, 'b': 200}", "testtype": "functional"}]
Mbpp_263
Write a function to merge two dictionaries.
263
mbpp
1
2024-11-26T21:40:54.290608
def merge_dict(d1,d2): d = d1.copy() d.update(d2) return d
merge_dict
easy
[{"input": "{'a':900,'b':900,'d':900},{'a':900,'b':900,'d':900}", "output": "{'a':900,'b':900,'d':900,'a':900,'b':900,'d':900}", "testtype": "functional"}]
Mbpp_263
Write a function to merge two dictionaries.
263
mbpp
2
2024-11-26T21:40:54.290768
def merge_dict(d1,d2): d = d1.copy() d.update(d2) return d
merge_dict
easy
[{"input": "{'a':10,'b':20},{'x':30,'y':40}", "output": "{'x':30,'y':40,'a':10,'b':20}", "testtype": "functional"}]
Mbpp_264
Write a function to calculate a dog's age in dog's years.
264
mbpp
0
2024-11-26T21:40:54.290984
def dog_age(h_age): if h_age < 0: exit() elif h_age <= 2: d_age = h_age * 10.5 else: d_age = 21 + (h_age - 2)*4 return d_age
dog_age
easy
[{"input": "12", "output": "61", "testtype": "functional"}]
Mbpp_264
Write a function to calculate a dog's age in dog's years.
264
mbpp
1
2024-11-26T21:40:54.291191
def dog_age(h_age): if h_age < 0: exit() elif h_age <= 2: d_age = h_age * 10.5 else: d_age = 21 + (h_age - 2)*4 return d_age
dog_age
easy
[{"input": "15", "output": "73", "testtype": "functional"}]
Mbpp_264
Write a function to calculate a dog's age in dog's years.
264
mbpp
2
2024-11-26T21:40:54.291411
def dog_age(h_age): if h_age < 0: exit() elif h_age <= 2: d_age = h_age * 10.5 else: d_age = 21 + (h_age - 2)*4 return d_age
dog_age
easy
[{"input": "24", "output": "109", "testtype": "functional"}]
Mbpp_265
Write a function to split a list for every nth element.
265
mbpp
0
2024-11-26T21:40:54.291568
def list_split(S, step): return [S[i::step] for i in range(step)]
list_split
easy
[{"input": "['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'],3", "output": "[['a', 'd', 'g', 'j', 'm'], ['b', 'e', 'h', 'k', 'n'], ['c', 'f', 'i', 'l']]", "testtype": "functional"}]
Mbpp_265
Write a function to split a list for every nth element.
265
mbpp
1
2024-11-26T21:40:54.291775
def list_split(S, step): return [S[i::step] for i in range(step)]
list_split
easy
[{"input": "[1,2,3,4,5,6,7,8,9,10,11,12,13,14],3", "output": "[[1,4,7,10,13], [2,5,8,11,14], [3,6,9,12]]", "testtype": "functional"}]
Mbpp_265
Write a function to split a list for every nth element.
265
mbpp
2
2024-11-26T21:40:54.291917
def list_split(S, step): return [S[i::step] for i in range(step)]
list_split
easy
[{"input": "['python','java','C','C++','DBMS','SQL'],2", "output": "[['python', 'C', 'DBMS'], ['java', 'C++', 'SQL']]", "testtype": "functional"}]
Mbpp_266
Write a function to find the lateral surface area of a cube.
266
mbpp
0
2024-11-26T21:40:54.292030
def lateralsurface_cube(l): LSA = 4 * (l * l) return LSA
lateralsurface_cube
easy
[{"input": "5", "output": "100", "testtype": "functional"}]
Mbpp_266
Write a function to find the lateral surface area of a cube.
266
mbpp
1
2024-11-26T21:40:54.292217
def lateralsurface_cube(l): LSA = 4 * (l * l) return LSA
lateralsurface_cube
easy
[{"input": "9", "output": "324", "testtype": "functional"}]
Mbpp_266
Write a function to find the lateral surface area of a cube.
266
mbpp
2
2024-11-26T21:40:54.292448
def lateralsurface_cube(l): LSA = 4 * (l * l) return LSA
lateralsurface_cube
easy
[{"input": "10", "output": "400", "testtype": "functional"}]
Mbpp_267
Write a python function to find the sum of squares of first n odd natural numbers.
267
mbpp
0
2024-11-26T21:40:54.292604
def square_Sum(n): return int(n*(4*n*n-1)/3)
square_Sum
easy
[{"input": "2", "output": "10", "testtype": "functional"}]
Mbpp_267
Write a python function to find the sum of squares of first n odd natural numbers.
267
mbpp
1
2024-11-26T21:40:54.292768
def square_Sum(n): return int(n*(4*n*n-1)/3)
square_Sum
easy
[{"input": "3", "output": "35", "testtype": "functional"}]
Mbpp_267
Write a python function to find the sum of squares of first n odd natural numbers.
267
mbpp
2
2024-11-26T21:40:54.292905
def square_Sum(n): return int(n*(4*n*n-1)/3)
square_Sum
easy
[{"input": "4", "output": "84", "testtype": "functional"}]
Mbpp_268
Write a function to find the n'th star number.
268
mbpp
0
2024-11-26T21:40:54.293143
def find_star_num(n): return (6 * n * (n - 1) + 1)
find_star_num
easy
[{"input": "3", "output": "37", "testtype": "functional"}]
Mbpp_268
Write a function to find the n'th star number.
268
mbpp
1
2024-11-26T21:40:54.293312
def find_star_num(n): return (6 * n * (n - 1) + 1)
find_star_num
easy
[{"input": "4", "output": "73", "testtype": "functional"}]
Mbpp_268
Write a function to find the n'th star number.
268
mbpp
2
2024-11-26T21:40:54.293430
def find_star_num(n): return (6 * n * (n - 1) + 1)
find_star_num
easy
[{"input": "5", "output": "121", "testtype": "functional"}]
Mbpp_269
Write a function to find the ascii value of a character.
269
mbpp
0
2024-11-26T21:40:54.293530
def ascii_value(k): ch=k return ord(ch)
ascii_value
easy
[{"input": "'A'", "output": "65", "testtype": "functional"}]
Mbpp_269
Write a function to find the ascii value of a character.
269
mbpp
1
2024-11-26T21:40:54.293630
def ascii_value(k): ch=k return ord(ch)
ascii_value
easy
[{"input": "'R'", "output": "82", "testtype": "functional"}]
Mbpp_269
Write a function to find the ascii value of a character.
269
mbpp
2
2024-11-26T21:40:54.293751
def ascii_value(k): ch=k return ord(ch)
ascii_value
easy
[{"input": "'S'", "output": "83", "testtype": "functional"}]
Mbpp_270
Write a python function to find the sum of even numbers at even positions.
270
mbpp
0
2024-11-26T21:40:54.294001
def sum_even_and_even_index(arr,n): i = 0 sum = 0 for i in range(0,n,2): if (arr[i] % 2 == 0) : sum += arr[i] return sum
sum_even_and_even_index
easy
[{"input": "[5, 6, 12, 1, 18, 8],6", "output": "30", "testtype": "functional"}]
Mbpp_270
Write a python function to find the sum of even numbers at even positions.
270
mbpp
1
2024-11-26T21:40:54.294262
def sum_even_and_even_index(arr,n): i = 0 sum = 0 for i in range(0,n,2): if (arr[i] % 2 == 0) : sum += arr[i] return sum
sum_even_and_even_index
easy
[{"input": "[3, 20, 17, 9, 2, 10, 18, 13, 6, 18],10", "output": "26", "testtype": "functional"}]
Mbpp_270
Write a python function to find the sum of even numbers at even positions.
270
mbpp
2
2024-11-26T21:40:54.294507
def sum_even_and_even_index(arr,n): i = 0 sum = 0 for i in range(0,n,2): if (arr[i] % 2 == 0) : sum += arr[i] return sum
sum_even_and_even_index
easy
[{"input": "[5, 6, 12, 1],4", "output": "12", "testtype": "functional"}]
Mbpp_271
Write a python function to find the sum of fifth power of first n even natural numbers.
271
mbpp
0
2024-11-26T21:40:54.294763
def even_Power_Sum(n): sum = 0; for i in range(1,n+1): j = 2*i; sum = sum + (j*j*j*j*j); return sum;
even_Power_Sum
easy
[{"input": "2", "output": "1056", "testtype": "functional"}]
Mbpp_271
Write a python function to find the sum of fifth power of first n even natural numbers.
271
mbpp
1
2024-11-26T21:40:54.294997
def even_Power_Sum(n): sum = 0; for i in range(1,n+1): j = 2*i; sum = sum + (j*j*j*j*j); return sum;
even_Power_Sum
easy
[{"input": "3", "output": "8832", "testtype": "functional"}]
Mbpp_271
Write a python function to find the sum of fifth power of first n even natural numbers.
271
mbpp
2
2024-11-26T21:40:54.295213
def even_Power_Sum(n): sum = 0; for i in range(1,n+1): j = 2*i; sum = sum + (j*j*j*j*j); return sum;
even_Power_Sum
easy
[{"input": "1", "output": "32", "testtype": "functional"}]
Mbpp_272
Write a function to perfom the rear element extraction from list of tuples records.
272
mbpp
0
2024-11-26T21:40:54.295388
def rear_extract(test_list): res = [lis[-1] for lis in test_list] return (res)
rear_extract
easy
[{"input": "[(1, 'Rash', 21), (2, 'Varsha', 20), (3, 'Kil', 19)]", "output": "[21, 20, 19]", "testtype": "functional"}]
Mbpp_272
Write a function to perfom the rear element extraction from list of tuples records.
272
mbpp
1
2024-11-26T21:40:54.295532
def rear_extract(test_list): res = [lis[-1] for lis in test_list] return (res)
rear_extract
easy
[{"input": "[(1, 'Sai', 36), (2, 'Ayesha', 25), (3, 'Salman', 45)]", "output": "[36, 25, 45]", "testtype": "functional"}]
Mbpp_272
Write a function to perfom the rear element extraction from list of tuples records.
272
mbpp
2
2024-11-26T21:40:54.295689
def rear_extract(test_list): res = [lis[-1] for lis in test_list] return (res)
rear_extract
easy
[{"input": "[(1, 'Sudeep', 14), (2, 'Vandana', 36), (3, 'Dawood', 56)]", "output": "[14, 36, 56]", "testtype": "functional"}]
Mbpp_273
Write a function to substract the contents of one tuple with corresponding index of other tuple.
273
mbpp
0
2024-11-26T21:40:54.295883
def substract_elements(test_tup1, test_tup2): res = tuple(map(lambda i, j: i - j, test_tup1, test_tup2)) return (res)
substract_elements
easy
[{"input": "(10, 4, 5), (2, 5, 18)", "output": "(8, -1, -13)", "testtype": "functional"}]
Mbpp_273
Write a function to substract the contents of one tuple with corresponding index of other tuple.
273
mbpp
1
2024-11-26T21:40:54.296049
def substract_elements(test_tup1, test_tup2): res = tuple(map(lambda i, j: i - j, test_tup1, test_tup2)) return (res)
substract_elements
easy
[{"input": "(11, 2, 3), (24, 45 ,16)", "output": "(-13, -43, -13)", "testtype": "functional"}]
Mbpp_273
Write a function to substract the contents of one tuple with corresponding index of other tuple.
273
mbpp
2
2024-11-26T21:40:54.296213
def substract_elements(test_tup1, test_tup2): res = tuple(map(lambda i, j: i - j, test_tup1, test_tup2)) return (res)
substract_elements
easy
[{"input": "(7, 18, 9), (10, 11, 12)", "output": "(-3, 7, -3)", "testtype": "functional"}]
Mbpp_274
Write a python function to find sum of even index binomial coefficients.
274
mbpp
0
2024-11-26T21:40:54.296341
import math def even_binomial_Coeff_Sum( n): return (1 << (n - 1))
even_binomial_Coeff_Sum
easy
[{"input": "4", "output": "8", "testtype": "functional"}]
Mbpp_274
Write a python function to find sum of even index binomial coefficients.
274
mbpp
1
2024-11-26T21:40:54.296444
import math def even_binomial_Coeff_Sum( n): return (1 << (n - 1))
even_binomial_Coeff_Sum
easy
[{"input": "6", "output": "32", "testtype": "functional"}]
Mbpp_274
Write a python function to find sum of even index binomial coefficients.
274
mbpp
2
2024-11-26T21:40:54.296545
import math def even_binomial_Coeff_Sum( n): return (1 << (n - 1))
even_binomial_Coeff_Sum
easy
[{"input": "2", "output": "2", "testtype": "functional"}]
Mbpp_275
Write a python function to find the position of the last removed element from the given array.
275
mbpp
0
2024-11-26T21:40:54.297011
import math as mt def get_Position(a,n,m): for i in range(n): a[i] = (a[i] // m + (a[i] % m != 0)) result,maxx = -1,-1 for i in range(n - 1,-1,-1): if (maxx < a[i]): maxx = a[i] result = i return result + 1
get_Position
easy
[{"input": "[2,5,4],3,2", "output": "2", "testtype": "functional"}]
Mbpp_275
Write a python function to find the position of the last removed element from the given array.
275
mbpp
1
2024-11-26T21:40:54.297454
import math as mt def get_Position(a,n,m): for i in range(n): a[i] = (a[i] // m + (a[i] % m != 0)) result,maxx = -1,-1 for i in range(n - 1,-1,-1): if (maxx < a[i]): maxx = a[i] result = i return result + 1
get_Position
easy
[{"input": "[4,3],2,2", "output": "2", "testtype": "functional"}]
Mbpp_275
Write a python function to find the position of the last removed element from the given array.
275
mbpp
2
2024-11-26T21:40:54.300285
import math as mt def get_Position(a,n,m): for i in range(n): a[i] = (a[i] // m + (a[i] % m != 0)) result,maxx = -1,-1 for i in range(n - 1,-1,-1): if (maxx < a[i]): maxx = a[i] result = i return result + 1
get_Position
easy
[{"input": "[1,2,3,4],4,1", "output": "4", "testtype": "functional"}]
Mbpp_276
Write a function to find the volume of a cylinder.
276
mbpp
0
2024-11-26T21:40:54.300516
def volume_cylinder(r,h): volume=3.1415*r*r*h return volume
volume_cylinder
easy
[{"input": "10,5", "output": "1570.7500000000002", "testtype": "functional"}]
Mbpp_276
Write a function to find the volume of a cylinder.
276
mbpp
1
2024-11-26T21:40:54.300673
def volume_cylinder(r,h): volume=3.1415*r*r*h return volume
volume_cylinder
easy
[{"input": "4,5", "output": "251.32000000000002", "testtype": "functional"}]
Mbpp_276
Write a function to find the volume of a cylinder.
276
mbpp
2
2024-11-26T21:40:54.300805
def volume_cylinder(r,h): volume=3.1415*r*r*h return volume
volume_cylinder
easy
[{"input": "4,10", "output": "502.64000000000004", "testtype": "functional"}]
Mbpp_277
Write a function to filter a dictionary based on values.
277
mbpp
0
2024-11-26T21:40:54.301014
def dict_filter(dict,n): result = {key:value for (key, value) in dict.items() if value >=n} return result
dict_filter
easy
[{"input": "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},170", "output": "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}", "testtype": "functional"}]
Mbpp_277
Write a function to filter a dictionary based on values.
277
mbpp
1
2024-11-26T21:40:54.301196
def dict_filter(dict,n): result = {key:value for (key, value) in dict.items() if value >=n} return result
dict_filter
easy
[{"input": "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},180", "output": "{ 'Alden Cantrell': 180, 'Pierre Cox': 190}", "testtype": "functional"}]
Mbpp_277
Write a function to filter a dictionary based on values.
277
mbpp
2
2024-11-26T21:40:54.301373
def dict_filter(dict,n): result = {key:value for (key, value) in dict.items() if value >=n} return result
dict_filter
easy
[{"input": "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},190", "output": "{ 'Pierre Cox': 190}", "testtype": "functional"}]
Mbpp_278
Write a function to find the element count that occurs before the record in the given tuple.
278
mbpp
0
2024-11-26T21:40:54.301541
def count_first_elements(test_tup): for count, ele in enumerate(test_tup): if isinstance(ele, tuple): break return (count)
count_first_elements
easy
[{"input": "(1, 5, 7, (4, 6), 10) ", "output": "3", "testtype": "functional"}]
Mbpp_278
Write a function to find the element count that occurs before the record in the given tuple.
278
mbpp
1
2024-11-26T21:40:54.301720
def count_first_elements(test_tup): for count, ele in enumerate(test_tup): if isinstance(ele, tuple): break return (count)
count_first_elements
easy
[{"input": "(2, 9, (5, 7), 11) ", "output": "2", "testtype": "functional"}]
Mbpp_278
Write a function to find the element count that occurs before the record in the given tuple.
278
mbpp
2
2024-11-26T21:40:54.301880
def count_first_elements(test_tup): for count, ele in enumerate(test_tup): if isinstance(ele, tuple): break return (count)
count_first_elements
easy
[{"input": "(11, 15, 5, 8, (2, 3), 8) ", "output": "4", "testtype": "functional"}]
Mbpp_279
Write a function to find the nth decagonal number.
279
mbpp
0
2024-11-26T21:40:54.301991
def is_num_decagonal(n): return 4 * n * n - 3 * n
is_num_decagonal
easy
[{"input": "3", "output": "27", "testtype": "functional"}]
Mbpp_279
Write a function to find the nth decagonal number.
279
mbpp
1
2024-11-26T21:40:54.302086
def is_num_decagonal(n): return 4 * n * n - 3 * n
is_num_decagonal
easy
[{"input": "7", "output": "175", "testtype": "functional"}]
Mbpp_279
Write a function to find the nth decagonal number.
279
mbpp
2
2024-11-26T21:40:54.302194
def is_num_decagonal(n): return 4 * n * n - 3 * n
is_num_decagonal
easy
[{"input": "10", "output": "370", "testtype": "functional"}]
Mbpp_280
Write a function to search an element in the given array by using sequential search.
280
mbpp
0
2024-11-26T21:40:54.302476
def sequential_search(dlist, item): pos = 0 found = False while pos < len(dlist) and not found: if dlist[pos] == item: found = True else: pos = pos + 1 return found, pos
sequential_search
easy
[{"input": "[11,23,58,31,56,77,43,12,65,19],31", "output": "(True, 3)", "testtype": "functional"}]
Mbpp_280
Write a function to search an element in the given array by using sequential search.
280
mbpp
1
2024-11-26T21:40:54.302769
def sequential_search(dlist, item): pos = 0 found = False while pos < len(dlist) and not found: if dlist[pos] == item: found = True else: pos = pos + 1 return found, pos
sequential_search
easy
[{"input": "[12, 32, 45, 62, 35, 47, 44, 61],61", "output": "(True, 7)", "testtype": "functional"}]
Mbpp_280
Write a function to search an element in the given array by using sequential search.
280
mbpp
2
2024-11-26T21:40:54.303071
def sequential_search(dlist, item): pos = 0 found = False while pos < len(dlist) and not found: if dlist[pos] == item: found = True else: pos = pos + 1 return found, pos
sequential_search
easy
[{"input": "[9, 10, 17, 19, 22, 39, 48, 56],48", "output": "(True, 6)", "testtype": "functional"}]
Mbpp_281
Write a python function to check if the elements of a given list are unique or not.
281
mbpp
0
2024-11-26T21:40:54.303247
def all_unique(test_list): if len(test_list) > len(set(test_list)): return False return True
all_unique
easy
[{"input": "[1,2,3]", "output": "True", "testtype": "functional"}]
Mbpp_281
Write a python function to check if the elements of a given list are unique or not.
281
mbpp
1
2024-11-26T21:40:54.303403
def all_unique(test_list): if len(test_list) > len(set(test_list)): return False return True
all_unique
easy
[{"input": "[1,2,1,2]", "output": "False", "testtype": "functional"}]
Mbpp_281
Write a python function to check if the elements of a given list are unique or not.
281
mbpp
2
2024-11-26T21:40:54.303538
def all_unique(test_list): if len(test_list) > len(set(test_list)): return False return True
all_unique
easy
[{"input": "[1,2,3,4,5]", "output": "True", "testtype": "functional"}]
Mbpp_282
Write a function to substaract two lists using map and lambda function.
282
mbpp
0
2024-11-26T21:40:54.303749
def sub_list(nums1,nums2): result = map(lambda x, y: x - y, nums1, nums2) return list(result)
sub_list
easy
[{"input": "[1, 2, 3],[4,5,6]", "output": "[-3,-3,-3]", "testtype": "functional"}]
Mbpp_282
Write a function to substaract two lists using map and lambda function.
282
mbpp
1
2024-11-26T21:40:54.303918
def sub_list(nums1,nums2): result = map(lambda x, y: x - y, nums1, nums2) return list(result)
sub_list
easy
[{"input": "[1,2],[3,4]", "output": "[-2,-2]", "testtype": "functional"}]
Mbpp_282
Write a function to substaract two lists using map and lambda function.
282
mbpp
2
2024-11-26T21:40:54.304072
def sub_list(nums1,nums2): result = map(lambda x, y: x - y, nums1, nums2) return list(result)
sub_list
easy
[{"input": "[90,120],[50,70]", "output": "[40,50]", "testtype": "functional"}]
Mbpp_283
Write a python function to check whether the frequency of each digit is less than or equal to the digit itself.
283
mbpp
0
2024-11-26T21:40:54.304359
def validate(n): for i in range(10): temp = n; count = 0; while (temp): if (temp % 10 == i): count+=1; if (count > i): return False temp //= 10; return True
validate
easy
[{"input": "1234", "output": "True", "testtype": "functional"}]
Mbpp_283
Write a python function to check whether the frequency of each digit is less than or equal to the digit itself.
283
mbpp
1
2024-11-26T21:40:54.304617
def validate(n): for i in range(10): temp = n; count = 0; while (temp): if (temp % 10 == i): count+=1; if (count > i): return False temp //= 10; return True
validate
easy
[{"input": "51241", "output": "False", "testtype": "functional"}]
Mbpp_283
Write a python function to check whether the frequency of each digit is less than or equal to the digit itself.
283
mbpp
2
2024-11-26T21:40:54.304908
def validate(n): for i in range(10): temp = n; count = 0; while (temp): if (temp % 10 == i): count+=1; if (count > i): return False temp //= 10; return True
validate
easy
[{"input": "321", "output": "True", "testtype": "functional"}]
Mbpp_284
Write a function to check whether all items of a list are equal to a given string.
284
mbpp
0
2024-11-26T21:40:54.305067
def check_element(list,element): check_element=all(v== element for v in list) return check_element
check_element
easy
[{"input": "[\"green\", \"orange\", \"black\", \"white\"],'blue'", "output": "False", "testtype": "functional"}]
Mbpp_284
Write a function to check whether all items of a list are equal to a given string.
284
mbpp
1
2024-11-26T21:40:54.305208
def check_element(list,element): check_element=all(v== element for v in list) return check_element
check_element
easy
[{"input": "[1,2,3,4],7", "output": "False", "testtype": "functional"}]
Mbpp_284
Write a function to check whether all items of a list are equal to a given string.
284
mbpp
2
2024-11-26T21:40:54.305353
def check_element(list,element): check_element=all(v== element for v in list) return check_element
check_element
easy
[{"input": "[\"green\", \"green\", \"green\", \"green\"],'green'", "output": "True", "testtype": "functional"}]
Mbpp_285
Write a function that matches a string that has an a followed by two to three 'b'.
285
mbpp
0
2024-11-26T21:40:54.305525
import re def text_match_two_three(text): patterns = 'ab{2,3}' if re.search(patterns, text): return 'Found a match!' else: return('Not matched!')
text_match_two_three
easy
[{"input": "\"ac\"", "output": "('Not matched!')", "testtype": "functional"}]