id
string
task_id
int64
prompt
string
entry_point
string
test_imports
list
test_list
list
test
string
Mbpp/439
439
Write a function to join a list of multiple integers into a single integer.
multiple_to_single
[]
[ "assert multiple_to_single([11, 33, 50])==113350", "assert multiple_to_single([-1,2,3,4,5,6])==-123456", "assert multiple_to_single([10,15,20,25])==10152025" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/440
440
Write a function to find the first adverb and their positions in a given sentence.
find_adverb_position
[]
[ "assert find_adverb_position(\"clearly!! we can see the sky\")==(0, 7, 'clearly')", "assert find_adverb_position(\"seriously!! there are many roses\")==(0, 9, 'seriously')", "assert find_adverb_position(\"unfortunately!! sita is going to home\")==(0, 13, 'unfortunately')" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/441
441
Write a function to find the surface area of a cube of a given size.
surfacearea_cube
[]
[ "assert surfacearea_cube(5)==150", "assert surfacearea_cube(3)==54", "assert surfacearea_cube(10)==600" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/445
445
Write a function to perform index wise multiplication of tuple elements in the given two tuples.
index_multiplication
[]
[ "assert index_multiplication(((1, 3), (4, 5), (2, 9), (1, 10)),((6, 7), (3, 9), (1, 1), (7, 3)) ) == ((6, 21), (12, 45), (2, 9), (7, 30))", "assert index_multiplication(((2, 4), (5, 6), (3, 10), (2, 11)),((7, 8), (4, 10), (2, 2), (8, 4)) ) == ((14, 32), (20, 60), (6, 20), (16, 44))", "assert index_multiplicatio...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/446
446
Write a python function to count the occurence of all elements of list in a tuple.
count_Occurrence
[]
[ "assert count_Occurrence(('a', 'a', 'c', 'b', 'd'),['a', 'b'] ) == 3", "assert count_Occurrence((1, 2, 3, 1, 4, 6, 7, 1, 4),[1, 4, 7]) == 6", "assert count_Occurrence((1,2,3,4,5,6),[1,2]) == 2" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/447
447
Write a function to find cubes of individual elements in a list.
cube_nums
[]
[ "assert cube_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]", "assert cube_nums([10,20,30])==([1000, 8000, 27000])", "assert cube_nums([12,15])==([1728, 3375])" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/448
448
Write a function to calculate the sum of perrin numbers.
cal_sum
[]
[ "assert cal_sum(9) == 49", "assert cal_sum(10) == 66", "assert cal_sum(11) == 88" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/450
450
Write a function to extract specified size of strings from a given list of string values.
extract_string
[]
[ "assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,8)==['practice', 'solution']", "assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,6)==['Python']", "assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,9)==['exercises']" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/451
451
Write a function to remove all whitespaces from the given string.
remove_whitespaces
[]
[ "assert remove_whitespaces(' Google Flutter ') == 'GoogleFlutter'", "assert remove_whitespaces(' Google Dart ') == 'GoogleDart'", "assert remove_whitespaces(' iOS Swift ') == 'iOSSwift'" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/453
453
Write a python function to find the sum of even factors of a number.
sumofFactors
[]
[ "assert sumofFactors(18) == 26", "assert sumofFactors(30) == 48", "assert sumofFactors(6) == 8" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/454
454
Write a function that matches a word containing 'z'.
text_match_wordz
[]
[ "assert text_match_wordz(\"pythonz.\")==True", "assert text_match_wordz(\"xyz.\")==True", "assert text_match_wordz(\" lang .\")==False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/455
455
Write a function to check whether the given month number contains 31 days or not.
check_monthnumb_number
[]
[ "assert check_monthnumb_number(5)==True", "assert check_monthnumb_number(2)==False", "assert check_monthnumb_number(6)==False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/456
456
Write a function to reverse each string in a given list of string values.
reverse_string_list
[]
[ "assert reverse_string_list(['Red', 'Green', 'Blue', 'White', 'Black'])==['deR', 'neerG', 'eulB', 'etihW', 'kcalB']", "assert reverse_string_list(['john','amal','joel','george'])==['nhoj','lama','leoj','egroeg']", "assert reverse_string_list(['jack','john','mary'])==['kcaj','nhoj','yram']" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/457
457
Write a python function to find the sublist having minimum length.
Find_Min
[]
[ "assert Find_Min([[1],[1,2],[1,2,3]]) == [1]", "assert Find_Min([[1,1],[1,1,1],[1,2,7,8]]) == [1,1]", "assert Find_Min([['x'],['x','y'],['x','y','z']]) == ['x']" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/458
458
Write a function to find the area of a rectangle.
rectangle_area
[]
[ "assert rectangle_area(10,20)==200", "assert rectangle_area(10,5)==50", "assert rectangle_area(4,2)==8" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/459
459
Write a function to remove uppercase substrings from a given string.
remove_uppercase
[]
[ "assert remove_uppercase('cAstyoUrFavoRitETVshoWs') == 'cstyoravoitshos'", "assert remove_uppercase('wAtchTheinTernEtrAdIo') == 'wtchheinerntrdo'", "assert remove_uppercase('VoicESeaRchAndreComMendaTionS') == 'oiceachndreomendaion'" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/460
460
Write a python function to get the first element of each sublist.
Extract
[]
[ "assert Extract([[1, 2], [3, 4, 5], [6, 7, 8, 9]]) == [1, 3, 6]", "assert Extract([[1,2,3],[4, 5]]) == [1,4]", "assert Extract([[9,8,1],[1,2]]) == [9,1]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/462
462
Write a function to find all possible combinations of the elements of a given list.
combinations_list
[]
[ "assert combinations_list(['orange', 'red', 'green', 'blue'])==[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue',...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/463
463
Write a function to find the maximum product subarray of the given array.
max_subarray_product
[]
[ "assert max_subarray_product([1, -2, -3, 0, 7, -8, -2]) == 112", "assert max_subarray_product([6, -3, -10, 0, 2]) == 180", "assert max_subarray_product([-2, -40, 0, -2, -3]) == 80" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/465
465
Write a function to drop empty items from a given dictionary.
drop_empty
[]
[ "assert drop_empty({'c1': 'Red', 'c2': 'Green', 'c3':None})=={'c1': 'Red', 'c2': 'Green'}", "assert drop_empty({'c1': 'Red', 'c2': None, 'c3':None})=={'c1': 'Red'}", "assert drop_empty({'c1': None, 'c2': 'Green', 'c3':None})=={ 'c2': 'Green'}" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/468
468
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
max_product
[]
[ "assert max_product([3, 100, 4, 5, 150, 6]) == 3000", "assert max_product([4, 42, 55, 68, 80]) == 50265600", "assert max_product([10, 22, 9, 33, 21, 50, 41, 60]) == 2460" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/470
470
Write a function to find the pairwise addition of the neighboring elements of the given tuple.
add_pairwise
[]
[ "assert add_pairwise((1, 5, 7, 8, 10)) == (6, 12, 15, 18)", "assert add_pairwise((2, 6, 8, 9, 11)) == (8, 14, 17, 20)", "assert add_pairwise((3, 7, 9, 10, 12)) == (10, 16, 19, 22)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/471
471
Write a python function to find the product of the array multiplication modulo n.
find_remainder
[]
[ "assert find_remainder([ 100, 10, 5, 25, 35, 14 ],11) ==9", "assert find_remainder([1,1,1],1) == 0", "assert find_remainder([1,2,1],2) == 0" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/472
472
Write a python function to check whether the given list contains consecutive numbers or not.
check_Consecutive
[]
[ "assert check_Consecutive([1,2,3,4,5]) == True", "assert check_Consecutive([1,2,3,5,6]) == False", "assert check_Consecutive([1,2,1]) == False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/473
473
Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order.
tuple_intersection
[]
[ "assert tuple_intersection([(3, 4), (5, 6), (9, 10), (4, 5)] , [(5, 4), (3, 4), (6, 5), (9, 11)]) == {(4, 5), (3, 4), (5, 6)}", "assert tuple_intersection([(4, 1), (7, 4), (11, 13), (17, 14)] , [(1, 4), (7, 4), (16, 12), (10, 13)]) == {(4, 7), (1, 4)}", "assert tuple_intersection([(2, 1), (3, 2), (1, 3), (1, 4)...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/474
474
Write a function to replace characters in a string.
replace_char
[]
[ "assert replace_char(\"polygon\",'y','l')==(\"pollgon\")", "assert replace_char(\"character\",'c','a')==(\"aharaater\")", "assert replace_char(\"python\",'l','a')==(\"python\")" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/475
475
Write a function to sort a dictionary by value.
sort_counter
[]
[ "assert sort_counter({'Math':81, 'Physics':83, 'Chemistry':87})==[('Chemistry', 87), ('Physics', 83), ('Math', 81)]", "assert sort_counter({'Math':400, 'Physics':300, 'Chemistry':250})==[('Math', 400), ('Physics', 300), ('Chemistry', 250)]", "assert sort_counter({'Math':900, 'Physics':1000, 'Chemistry':1250})==...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/476
476
Write a python function to find the sum of the largest and smallest value in a given array.
big_sum
[]
[ "assert big_sum([1,2,3]) == 4", "assert big_sum([-1,2,3,4]) == 3", "assert big_sum([2,3,6]) == 8" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/477
477
Write a python function to convert the given string to lower case.
is_lower
[]
[ "assert is_lower(\"InValid\") == \"invalid\"", "assert is_lower(\"TruE\") == \"true\"", "assert is_lower(\"SenTenCE\") == \"sentence\"" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/478
478
Write a function to remove lowercase substrings from a given string.
remove_lowercase
[]
[ "assert remove_lowercase(\"PYTHon\")==('PYTH')", "assert remove_lowercase(\"FInD\")==('FID')", "assert remove_lowercase(\"STRinG\")==('STRG')" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/479
479
Write a python function to find the first digit of a given number.
first_Digit
[]
[ "assert first_Digit(123) == 1", "assert first_Digit(456) == 4", "assert first_Digit(12) == 1" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/554
554
Write a python function which takes a list of integers and only returns the odd ones.
Split
[]
[ "assert Split([1,2,3,4,5,6]) == [1,3,5]", "assert Split([10,11,12,13]) == [11,13]", "assert Split([7,8,9,1]) == [7,9,1]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/555
555
Write a python function to find the difference between the sum of cubes of the first n natural numbers and the sum of the first n natural numbers.
difference
[]
[ "assert difference(3) == 30", "assert difference(5) == 210", "assert difference(2) == 6" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/556
556
Write a python function to count the number of pairs whose xor value is odd.
find_Odd_Pair
[]
[ "assert find_Odd_Pair([5,4,7,2,1],5) == 6", "assert find_Odd_Pair([7,2,8,1,0,5,11],7) == 12", "assert find_Odd_Pair([1,2,3],3) == 2" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/557
557
Write a function to toggle the case of all characters in a string.
toggle_string
[]
[ "assert toggle_string(\"Python\")==(\"pYTHON\")", "assert toggle_string(\"Pangram\")==(\"pANGRAM\")", "assert toggle_string(\"LIttLE\")==(\"liTTle\")" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/558
558
Write a python function to find the sum of the per-digit difference between two integers.
digit_distance_nums
[]
[ "assert digit_distance_nums(1,2) == 1", "assert digit_distance_nums(23,56) == 6", "assert digit_distance_nums(123,256) == 7" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/559
559
Write a function to find the sum of the largest contiguous sublist in the given list.
max_sub_array_sum
[]
[ "assert max_sub_array_sum([-2, -3, 4, -1, -2, 1, 5, -3], 8) == 7", "assert max_sub_array_sum([-3, -4, 5, -2, -3, 2, 6, -4], 8) == 8", "assert max_sub_array_sum([-4, -5, 6, -3, -4, 3, 7, -5], 8) == 10" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/560
560
Write a function to find the union of the elements of two given tuples and output them in sorted order.
union_elements
[]
[ "assert union_elements((3, 4, 5, 6),(5, 7, 4, 10) ) == (3, 4, 5, 6, 7, 10)", "assert union_elements((1, 2, 3, 4),(3, 4, 5, 6) ) == (1, 2, 3, 4, 5, 6)", "assert union_elements((11, 12, 13, 14),(13, 15, 16, 17) ) == (11, 12, 13, 14, 15, 16, 17)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/562
562
Write a python function to find the length of the longest sublists.
Find_Max_Length
[]
[ "assert Find_Max_Length([[1],[1,4],[5,6,7,8]]) == 4", "assert Find_Max_Length([[0,1],[2,2,],[3,2,1]]) == 3", "assert Find_Max_Length([[7],[22,23],[13,14,15],[10,20,30,40,50]]) == 5" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/563
563
Write a function to extract values between quotation marks from a string.
extract_values
[]
[ "assert extract_values('\"Python\", \"PHP\", \"Java\"')==['Python', 'PHP', 'Java']", "assert extract_values('\"python\",\"program\",\"language\"')==['python','program','language']", "assert extract_values('\"red\",\"blue\",\"green\",\"yellow\"')==['red','blue','green','yellow']" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/564
564
Write a python function which takes a list of integers and counts the number of possible unordered pairs where both elements are unequal.
count_Pairs
[]
[ "assert count_Pairs([1,2,1],3) == 2", "assert count_Pairs([1,1,1,1],4) == 0", "assert count_Pairs([1,2,3,4,5],5) == 10" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/565
565
Write a python function to split a string into characters.
split
[]
[ "assert split('python') == ['p','y','t','h','o','n']", "assert split('Name') == ['N','a','m','e']", "assert split('program') == ['p','r','o','g','r','a','m']" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/566
566
Write a function to get the sum of the digits of a non-negative integer.
sum_digits
[]
[ "assert sum_digits(345)==12", "assert sum_digits(12)==3", "assert sum_digits(97)==16" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/567
567
Write a function to check whether a specified list is sorted or not.
issort_list
[]
[ "assert issort_list([1,2,4,6,8,10,12,14,16,17])==True", "assert issort_list([1, 2, 4, 6, 8, 10, 12, 14, 20, 17])==False", "assert issort_list([1, 2, 4, 6, 8, 10,15,14,20])==False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/568
568
Write a function to create a list of N empty dictionaries.
empty_list
[]
[ "assert empty_list(5)==[{},{},{},{},{}]", "assert empty_list(6)==[{},{},{},{},{},{}]", "assert empty_list(7)==[{},{},{},{},{},{},{}]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/569
569
Write a function to sort each sublist of strings in a given list of lists.
sort_sublists
[]
[ "assert sort_sublists([['green', 'orange'], ['black', 'white'], ['white', 'black', 'orange']])==[['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]", "assert sort_sublists([['green', 'orange'], ['black'], ['green', 'orange'], ['white']])==[['green', 'orange'], ['black'], ['green', 'orange'], [...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/572
572
Write a python function to remove duplicate numbers from a given number of lists.
two_unique_nums
[]
[ "assert two_unique_nums([1,2,3,2,3,4,5]) == [1, 4, 5]", "assert two_unique_nums([1,2,3,2,4,5]) == [1, 3, 4, 5]", "assert two_unique_nums([1,2,3,4,5]) == [1, 2, 3, 4, 5]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/573
573
Write a python function to calculate the product of the unique numbers in a given list.
unique_product
[]
[ "assert unique_product([10, 20, 30, 40, 20, 50, 60, 40]) == 720000000", "assert unique_product([1, 2, 3, 1,]) == 6", "assert unique_product([7, 8, 9, 0, 1, 1]) == 0" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/576
576
Write a python function to check whether a list is sublist of another or not.
is_Sub_Array
[]
[ "assert is_Sub_Array([1,4,3,5],[1,2]) == False", "assert is_Sub_Array([1,2,1],[1,2,1]) == True", "assert is_Sub_Array([1,0,2,2],[2,2,0]) ==False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/577
577
Write a python function to find the last digit in factorial of a given number.
last_Digit_Factorial
[]
[ "assert last_Digit_Factorial(4) == 4", "assert last_Digit_Factorial(21) == 0", "assert last_Digit_Factorial(30) == 0" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/578
578
Write a function to interleave 3 lists of the same length into a single flat list.
interleave_lists
[]
[ "assert interleave_lists([1,2,3,4,5,6,7],[10,20,30,40,50,60,70],[100,200,300,400,500,600,700])==[1, 10, 100, 2, 20, 200, 3, 30, 300, 4, 40, 400, 5, 50, 500, 6, 60, 600, 7, 70, 700]", "assert interleave_lists([10,20],[15,2],[5,10])==[10,15,5,20,2,10]", "assert interleave_lists([11,44], [10,15], [20,5])==[11,10,2...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/579
579
Write a function to find the dissimilar elements in the given two tuples.
find_dissimilar
[]
[ "assert find_dissimilar((3, 4, 5, 6), (5, 7, 4, 10)) == (3, 6, 7, 10)", "assert find_dissimilar((1, 2, 3, 4), (7, 2, 3, 9)) == (1, 4, 7, 9)", "assert find_dissimilar((21, 11, 25, 26), (26, 34, 21, 36)) == (34, 36, 11, 25)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/580
580
Write a function to remove uneven elements in the nested mixed tuple.
even_ele
[]
[ "assert extract_even((4, 5, (7, 6, (2, 4)), 6, 8)) == (4, (6, (2, 4)), 6, 8)", "assert extract_even((5, 6, (8, 7, (4, 8)), 7, 9)) == (6, (8, (4, 8)))", "assert extract_even((5, 6, (9, 8, (4, 6)), 8, 10)) == (6, (8, (4, 6)), 8, 10)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/581
581
Write a python function to find the surface area of a square pyramid with a given base edge and height.
surface_Area
[]
[ "assert surface_Area(3,4) == 33", "assert surface_Area(4,5) == 56", "assert surface_Area(1,2) == 5" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/583
583
Write a function which returns nth catalan number.
catalan_number
[]
[ "assert catalan_number(10)==16796", "assert catalan_number(9)==4862", "assert catalan_number(7)==429" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/585
585
Write a function to find the n most expensive items in a given dataset.
expensive_items
[]
[ "assert expensive_items([{'name': 'Item-1', 'price': 101.1},{'name': 'Item-2', 'price': 555.22}],1)==[{'name': 'Item-2', 'price': 555.22}]", "assert expensive_items([{'name': 'Item-1', 'price': 101.1},{'name': 'Item-2', 'price': 555.22}, {'name': 'Item-3', 'price': 45.09}],2)==[{'name': 'Item-2', 'price': 555.22}...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/586
586
Write a python function to split a list at the nth eelment and add the first part to the end.
split_Arr
[]
[ "assert split_Arr([12,10,5,6,52,36],2) == [5,6,52,36,12,10]", "assert split_Arr([1,2,3,4],1) == [2,3,4,1]", "assert split_Arr([0,1,2,3,4,5,6,7],3) == [3,4,5,6,7,0,1,2]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/587
587
Write a function to convert a list to a tuple.
list_tuple
[]
[ "assert list_tuple([5, 10, 7, 4, 15, 3])==(5, 10, 7, 4, 15, 3)", "assert list_tuple([2, 4, 5, 6, 2, 3, 4, 4, 7])==(2, 4, 5, 6, 2, 3, 4, 4, 7)", "assert list_tuple([58,44,56])==(58,44,56)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/588
588
Write a python function to find the difference between largest and smallest value in a given list.
big_diff
[]
[ "assert big_diff([1,2,3,4]) == 3", "assert big_diff([4,5,12]) == 8", "assert big_diff([9,2,3]) == 7" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/589
589
Write a function to find perfect squares between two given numbers.
perfect_squares
[]
[ "assert perfect_squares(1,30)==[1, 4, 9, 16, 25]", "assert perfect_squares(50,100)==[64, 81, 100]", "assert perfect_squares(100,200)==[100, 121, 144, 169, 196]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/590
590
Write a function to convert polar coordinates to rectangular coordinates.
polar_rect
[]
[ "assert polar_rect(3,4)==((5.0, 0.9272952180016122), (-2+2.4492935982947064e-16j))", "assert polar_rect(4,7)==((8.06225774829855, 1.0516502125483738), (-2+2.4492935982947064e-16j))", "assert polar_rect(15,17)==((22.67156809750927, 0.8478169733934057), (-2+2.4492935982947064e-16j))" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/591
591
Write a python function to interchange the first and last elements in a list.
swap_List
[]
[ "assert swap_List([12, 35, 9, 56, 24]) == [24, 35, 9, 56, 12]", "assert swap_List([1, 2, 3]) == [3, 2, 1]", "assert swap_List([4, 5, 6]) == [6, 5, 4]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/592
592
Write a python function to find the sum of the product of consecutive binomial co-efficients.
binomial_Coeff
[]
[ "assert sum_Of_product(3) == 15", "assert sum_Of_product(4) == 56", "assert sum_Of_product(1) == 1" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/593
593
Write a function to remove leading zeroes from an ip address.
removezero_ip
[]
[ "assert removezero_ip(\"216.08.094.196\")==('216.8.94.196')", "assert removezero_ip(\"12.01.024\")==('12.1.24')", "assert removezero_ip(\"216.08.094.0196\")==('216.8.94.196')" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/594
594
Write a function to find the difference of the first even and first odd number of a given list.
diff_even_odd
[]
[ "assert diff_even_odd([1,3,5,7,4,1,6,8])==3", "assert diff_even_odd([1,2,3,4,5,6,7,8,9,10])==1", "assert diff_even_odd([1,5,7,9,10])==9" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/596
596
Write a function to find the size in bytes of the given tuple.
tuple_size
[]
[ "assert tuple_size((\"A\", 1, \"B\", 2, \"C\", 3) ) == sys.getsizeof((\"A\", 1, \"B\", 2, \"C\", 3))", "assert tuple_size((1, \"Raju\", 2, \"Nikhil\", 3, \"Deepanshu\") ) == sys.getsizeof((1, \"Raju\", 2, \"Nikhil\", 3, \"Deepanshu\"))", "assert tuple_size(((1, \"Lion\"), ( 2, \"Tiger\"), (3, \"Fox\"), (4, \"Wo...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/597
597
Write a function to find kth element from the given two sorted arrays.
find_kth
[]
[ "assert find_kth([2, 3, 6, 7, 9], [1, 4, 8, 10], 5) == 6", "assert find_kth([100, 112, 256, 349, 770], [72, 86, 113, 119, 265, 445, 892], 7) == 256", "assert find_kth([3, 4, 7, 8, 10], [2, 5, 9, 11], 6) == 8" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/598
598
Write a function to check whether the given number is armstrong or not.
armstrong_number
[]
[ "assert armstrong_number(153)==True", "assert armstrong_number(259)==False", "assert armstrong_number(4458)==False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/599
599
Write a function to find sum and average of first n natural numbers.
sum_average
[]
[ "assert sum_average(10)==(55, 5.5)", "assert sum_average(15)==(120, 8.0)", "assert sum_average(20)==(210, 10.5)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/600
600
Write a python function to check whether the given number is even or not.
is_Even
[]
[ "assert is_Even(1) == False", "assert is_Even(2) == True", "assert is_Even(3) == False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/602
602
Write a python function to find the first repeated character in a given string.
first_repeated_char
[]
[ "assert first_repeated_char(\"abcabc\") == \"a\"", "assert first_repeated_char(\"abc\") == None", "assert first_repeated_char(\"123123\") == \"1\"" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/603
603
Write a function to get all lucid numbers smaller than or equal to a given integer.
get_ludic
[]
[ "assert get_ludic(10) == [1, 2, 3, 5, 7]", "assert get_ludic(25) == [1, 2, 3, 5, 7, 11, 13, 17, 23, 25]", "assert get_ludic(45) == [1, 2, 3, 5, 7, 11, 13, 17, 23, 25, 29, 37, 41, 43]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/604
604
Write a function to reverse words seperated by spaces in a given string.
reverse_words
[]
[ "assert reverse_words(\"python program\")==(\"program python\")", "assert reverse_words(\"java language\")==(\"language java\")", "assert reverse_words(\"indian man\")==(\"man indian\")" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/605
605
Write a function to check if the given integer is a prime number.
prime_num
[]
[ "assert prime_num(13)==True", "assert prime_num(7)==True", "assert prime_num(-1010)==False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/606
606
Write a function to convert degrees to radians.
radian_degree
[]
[ "assert radian_degree(90)==1.5707963267948966", "assert radian_degree(60)==1.0471975511965976", "assert radian_degree(120)==2.0943951023931953" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/607
607
Write a function to search a string for a regex pattern. The function should return the matching subtring, a start index and an end index.
find_literals
[]
[ "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)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/608
608
Write a python function to find nth bell number.
bell_Number
[]
[ "assert bell_Number(2) == 2", "assert bell_Number(3) == 5", "assert bell_Number(4) == 15" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/610
610
Write a python function which takes a list and returns a list with the same elements, but the k'th element removed.
remove_kth_element
[]
[ "assert remove_kth_element([1,1,2,3,4,4,5,1],3)==[1, 1, 3, 4, 4, 5, 1]", "assert remove_kth_element([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4],4)==[0, 0, 1, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4]", "assert remove_kth_element([10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10],5)==[10,10,15,19, 18, 17, 26, 26, 1...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/611
611
Write a function which given a matrix represented as a list of lists returns the max of the n'th column.
max_of_nth
[]
[ "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" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/612
612
Write a python function which takes a list of lists, where each sublist has two elements, and returns a list of two lists where the first list has the first element of each sublist and the second one has the second.
merge
[]
[ "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']]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/614
614
Write a function to find the cumulative sum of all the values that are present in the given tuple list.
cummulative_sum
[]
[ "assert cummulative_sum([(1, 3), (5, 6, 7), (2, 6)]) == 30", "assert cummulative_sum([(2, 4), (6, 7, 8), (3, 7)]) == 37", "assert cummulative_sum([(3, 5), (7, 8, 9), (4, 8)]) == 44" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/615
615
Write a function which takes a tuple of tuples and returns the average value for each tuple as a list.
average_tuple
[]
[ "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...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/616
616
Write a function which takes two tuples of the same length and performs the element wise modulo.
tuple_modulo
[]
[ "assert tuple_modulo((10, 4, 5, 6), (5, 6, 7, 5)) == (0, 4, 5, 1)", "assert tuple_modulo((11, 5, 6, 7), (6, 7, 8, 6)) == (5, 5, 6, 1)", "assert tuple_modulo((12, 6, 7, 8), (7, 8, 9, 7)) == (5, 6, 7, 1)" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/618
618
Write a function to divide two lists element wise.
div_list
[]
[ "assert div_list([4,5,6],[1, 2, 3])==[4.0,2.5,2.0]", "assert div_list([3,2],[1,4])==[3.0, 0.5]", "assert div_list([90,120],[50,70])==[1.8, 1.7142857142857142]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/619
619
Write a function to move all the numbers to the end of the given string.
move_num
[]
[ "assert move_num('I1love143you55three3000thousand') == 'Iloveyouthreethousand1143553000'", "assert move_num('Avengers124Assemble') == 'AvengersAssemble124'", "assert move_num('Its11our12path13to14see15things16do17things') == 'Itsourpathtoseethingsdothings11121314151617'" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/620
620
Write a function to find the size of the largest subset of a list of numbers so that every pair is divisible.
largest_subset
[]
[ "assert largest_subset([ 1, 3, 6, 13, 17, 18 ]) == 4", "assert largest_subset([10, 5, 3, 15, 20]) == 3", "assert largest_subset([18, 1, 3, 6, 13, 17]) == 4" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/622
622
Write a function to find the median of two sorted lists of same size.
get_median
[]
[ "assert get_median([1, 12, 15, 26, 38], [2, 13, 17, 30, 45], 5) == 16.0", "assert get_median([2, 4, 8, 9], [7, 13, 19, 28], 4) == 8.5", "assert get_median([3, 6, 14, 23, 36, 42], [2, 18, 27, 39, 49, 55], 6) == 25.0" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/623
623
Write a function to compute the n-th power of each number in a list.
nth_nums
[]
[ "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])" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/624
624
Write a python function to convert a given string to uppercase.
is_upper
[]
[ "assert is_upper(\"person\") ==\"PERSON\"", "assert is_upper(\"final\") == \"FINAL\"", "assert is_upper(\"Valid\") == \"VALID\"" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/626
626
Write a python function to find the area of the largest triangle that can be inscribed in a semicircle with a given radius.
triangle_area
[]
[ "assert triangle_area(-1) == None", "assert triangle_area(0) == 0", "assert triangle_area(2) == 4" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/628
628
Write a function to replace all spaces in the given string with '%20'.
replace_spaces
[]
[ "assert replace_spaces(\"My Name is Dawood\") == 'My%20Name%20is%20Dawood'", "assert replace_spaces(\"I am a Programmer\") == 'I%20am%20a%20Programmer'", "assert replace_spaces(\"I love Coding\") == 'I%20love%20Coding'" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/629
629
Write a python function to find even numbers from a list of numbers.
Split
[]
[ "assert Split([1,2,3,4,5]) == [2,4]", "assert Split([4,5,6,7,8,0,1]) == [4,6,8,0]", "assert Split ([8,12,15,19]) == [8,12]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/630
630
Write a function to extract all the adjacent coordinates of the given coordinate tuple.
adjac
[]
[ "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], [...
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/631
631
Write a function to replace whitespaces with an underscore and vice versa in a given string.
replace_spaces
[]
[ "assert replace_spaces('Jumanji The Jungle') == 'Jumanji_The_Jungle'", "assert replace_spaces('The_Avengers') == 'The Avengers'", "assert replace_spaces('Fast and Furious') == 'Fast_and_Furious'" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/632
632
Write a python function to move all zeroes to the end of the given list.
move_zero
[]
[ "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]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/633
633
Write a python function to find the sum of xor of all pairs of numbers in the given list.
pair_xor_Sum
[]
[ "assert pair_xor_Sum([5,9,7,6],4) == 47", "assert pair_xor_Sum([7,3,5],3) == 12", "assert pair_xor_Sum([7,3],2) == 4" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/635
635
Write a function to sort the given list.
heap_sort
[]
[ "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]" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/637
637
Write a function to check whether the given amount has no profit and no loss
noprofit_noloss
[]
[ "assert noprofit_noloss(1500,1200)==False", "assert noprofit_noloss(100,100)==True", "assert noprofit_noloss(2000,5000)==False" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/638
638
Write a function to calculate the wind chill index rounded to the next integer given the wind velocity in km/h and a temperature in celsius.
wind_chill
[]
[ "assert wind_chill(120,35)==40", "assert wind_chill(40,20)==19", "assert wind_chill(10,8)==6" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...
Mbpp/639
639
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.
sample_nam
[]
[ "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" ]
import numpy as np from math import inf def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == n...