task_id stringlengths 6 8 | text stringlengths 368 1.62k |
|---|---|
Mbpp/439 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to join a list of multiple integers into a single integer
assert multiple_to_single([11, 33, 50])==113350
```
### Answer:
Below is a Python script with a self-contained function that solves the... |
Mbpp/440 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the first adverb and their positions in a given sentence
assert find_adverb_position("clearly!! we can see the sky")==(0, 7, 'clearly')
```
### Answer:
Below is a Python script with a s... |
Mbpp/441 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the surface area of a cube of a given size
assert surfacearea_cube(5)==150
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes cor... |
Mbpp/445 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to perform index wise multiplication of tuple elements in the given two tuples
assert index_multiplication(((1, 3), (4, 5), (2, 9), (1, 10)),((6, 7), (3, 9), (1, 1), (7, 3)) ) == ((6, 21), (12,... |
Mbpp/446 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to count the occurence of all elements of list in a tuple
assert count_Occurrence(('a', 'a', 'c', 'b', 'd'),['a', 'b'] ) == 3
```
### Answer:
Below is a Python script with a self-contain... |
Mbpp/447 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find cubes of individual elements in a list
assert cube_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]
```
### Answer:
Below is a Python script with a s... |
Mbpp/448 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to calculate the sum of perrin numbers
assert cal_sum(9) == 49
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes corresponding tests:
``... |
Mbpp/450 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to extract specified size of strings from a given list of string values
assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,8)==['practice', 'solution']
```
### Answe... |
Mbpp/451 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to remove all whitespaces from the given string
assert remove_whitespaces(' Google Flutter ') == 'GoogleFlutter'
```
### Answer:
Below is a Python script with a self-contained function that ... |
Mbpp/453 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the sum of even factors of a number
assert sumofFactors(18) == 26
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes corre... |
Mbpp/454 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function that matches a word containing 'z'
assert text_match_wordz("pythonz.")==True
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes correspon... |
Mbpp/455 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to check whether the given month number contains 31 days or not
assert check_monthnumb_number(5)==True
```
### Answer:
Below is a Python script with a self-contained function that solves the pr... |
Mbpp/456 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to reverse each string in a given list of string values
assert reverse_string_list(['Red', 'Green', 'Blue', 'White', 'Black'])==['deR', 'neerG', 'eulB', 'etihW', 'kcalB']
```
### Answer:
Below ... |
Mbpp/457 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the sublist having minimum length
assert Find_Min([[1],[1,2],[1,2,3]]) == [1]
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and ... |
Mbpp/458 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the area of a rectangle
assert rectangle_area(10,20)==200
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes corresponding tests:... |
Mbpp/459 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to remove uppercase substrings from a given string
assert remove_uppercase('cAstyoUrFavoRitETVshoWs') == 'cstyoravoitshos'
```
### Answer:
Below is a Python script with a self-contained functio... |
Mbpp/460 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to get the first element of each sublist
assert Extract([[1, 2], [3, 4, 5], [6, 7, 8, 9]]) == [1, 3, 6]
```
### Answer:
Below is a Python script with a self-contained function that solve... |
Mbpp/462 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find all possible combinations of the elements of a given list
assert combinations_list(['orange', 'red', 'green', 'blue'])==[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green',... |
Mbpp/463 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the maximum product subarray of the given array
assert max_subarray_product([1, -2, -3, 0, 7, -8, -2]) == 112
```
### Answer:
Below is a Python script with a self-contained function tha... |
Mbpp/465 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to drop empty items from a given dictionary
assert drop_empty({'c1': 'Red', 'c2': 'Green', 'c3':None})=={'c1': 'Red', 'c2': 'Green'}
```
### Answer:
Below is a Python script with a self-contain... |
Mbpp/468 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array
assert max_product([3, 100, 4, 5, 150, 6]) == 3000
```
### Answer:
Below is a Python script ... |
Mbpp/470 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the pairwise addition of the neighboring elements of the given tuple
assert add_pairwise((1, 5, 7, 8, 10)) == (6, 12, 15, 18)
```
### Answer:
Below is a Python script with a self-contai... |
Mbpp/471 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the product of the array multiplication modulo n
assert find_remainder([ 100, 10, 5, 25, 35, 14 ],11) ==9
```
### Answer:
Below is a Python script with a self-contained function ... |
Mbpp/472 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to check whether the given list contains consecutive numbers or not
assert check_Consecutive([1,2,3,4,5]) == True
```
### Answer:
Below is a Python script with a self-contained function ... |
Mbpp/473 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order
assert tuple_intersection([(3, 4), (5, 6), (9, 10), (4, 5)] , [(5, 4), (3, 4), (6, 5), (9, 11)]) =... |
Mbpp/474 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to replace characters in a string
assert replace_char("polygon",'y','l')==("pollgon")
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes ... |
Mbpp/475 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to sort a dictionary by value
assert sort_counter({'Math':81, 'Physics':83, 'Chemistry':87})==[('Chemistry', 87), ('Physics', 83), ('Math', 81)]
```
### Answer:
Below is a Python script with a ... |
Mbpp/476 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the sum of the largest and smallest value in a given array
assert big_sum([1,2,3]) == 4
```
### Answer:
Below is a Python script with a self-contained function that solves the pr... |
Mbpp/477 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to convert the given string to lower case
assert is_lower("InValid") == "invalid"
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and pass... |
Mbpp/478 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to remove lowercase substrings from a given string
assert remove_lowercase("PYTHon")==('PYTH')
```
### Answer:
Below is a Python script with a self-contained function that solves the problem an... |
Mbpp/479 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the first digit of a given number
assert first_Digit(123) == 1
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes correspo... |
Mbpp/554 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function which takes a list of integers and only returns the odd ones
assert Split([1,2,3,4,5,6]) == [1,3,5]
```
### Answer:
Below is a Python script with a self-contained function that solves th... |
Mbpp/555 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
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
assert difference(3) == 30
```
### Answer:
Below is a Python scr... |
Mbpp/556 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to count the number of pairs whose xor value is odd
assert find_Odd_Pair([5,4,7,2,1],5) == 6
```
### Answer:
Below is a Python script with a self-contained function that solves the probl... |
Mbpp/557 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to toggle the case of all characters in a string
assert toggle_string("Python")==("pYTHON")
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and p... |
Mbpp/558 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the sum of the per-digit difference between two integers
assert digit_distance_nums(1,2) == 1
```
### Answer:
Below is a Python script with a self-contained function that solves ... |
Mbpp/559 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the sum of the largest contiguous sublist in the given list
assert max_sub_array_sum([-2, -3, 4, -1, -2, 1, 5, -3], 8) == 7
```
### Answer:
Below is a Python script with a self-containe... |
Mbpp/560 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the union of the elements of two given tuples and output them in sorted order
assert union_elements((3, 4, 5, 6),(5, 7, 4, 10) ) == (3, 4, 5, 6, 7, 10)
```
### Answer:
Below is a Python... |
Mbpp/562 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the length of the longest sublists
assert Find_Max_Length([[1],[1,4],[5,6,7,8]]) == 4
```
### Answer:
Below is a Python script with a self-contained function that solves the prob... |
Mbpp/563 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to extract values between quotation marks from a string
assert extract_values('"Python", "PHP", "Java"')==['Python', 'PHP', 'Java']
```
### Answer:
Below is a Python script with a self-containe... |
Mbpp/564 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function which takes a list of integers and counts the number of possible unordered pairs where both elements are unequal
assert count_Pairs([1,2,1],3) == 2
```
### Answer:
Below is a Python scri... |
Mbpp/565 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to split a string into characters
assert split('python') == ['p','y','t','h','o','n']
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and ... |
Mbpp/566 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to get the sum of the digits of a non-negative integer
assert sum_digits(345)==12
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes corr... |
Mbpp/567 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to check whether a specified list is sorted or not
assert issort_list([1,2,4,6,8,10,12,14,16,17])==True
```
### Answer:
Below is a Python script with a self-contained function that solves the p... |
Mbpp/568 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to create a list of N empty dictionaries
assert empty_list(5)==[{},{},{},{},{}]
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes corres... |
Mbpp/569 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to sort each sublist of strings in a given list of lists
assert sort_sublists((["green", "orange"], ["black", "white"], ["white", "black", "orange"]))==[['green', 'orange'], ['black', 'white'],... |
Mbpp/572 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to remove duplicate numbers from a given number of lists
assert two_unique_nums([1,2,3,2,3,4,5]) == [1, 4, 5]
```
### Answer:
Below is a Python script with a self-contained function that... |
Mbpp/573 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to calculate the product of the unique numbers in a given list
assert unique_product([10, 20, 30, 40, 20, 50, 60, 40]) == 720000000
```
### Answer:
Below is a Python script with a self-... |
Mbpp/576 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to check whether a list is sublist of another or not
assert is_Sub_Array([1,4,3,5],[1,2]) == False
```
### Answer:
Below is a Python script with a self-contained function that solves the... |
Mbpp/577 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the last digit in factorial of a given number
assert last_Digit_Factorial(4) == 4
```
### Answer:
Below is a Python script with a self-contained function that solves the problem ... |
Mbpp/578 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to interleave 3 lists of the same length into a single flat list
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, 3... |
Mbpp/579 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the dissimilar elements in the given two tuples
assert find_dissimilar((3, 4, 5, 6), (5, 7, 4, 10)) == (3, 6, 7, 10)
```
### Answer:
Below is a Python script with a self-contained funct... |
Mbpp/580 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to remove uneven elements in the nested mixed tuple
assert extract_even((4, 5, (7, 6, (2, 4)), 6, 8)) == (4, (6, (2, 4)), 6, 8)
```
### Answer:
Below is a Python script with a self-contained fu... |
Mbpp/581 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the surface area of a square pyramid with a given base edge and height
assert surface_Area(3,4) == 33
```
### Answer:
Below is a Python script with a self-contained function that... |
Mbpp/583 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function which returns nth catalan number
assert catalan_number(10)==16796
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes corresponding tests:... |
Mbpp/585 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the n most expensive items in a given dataset
assert expensive_items([{'name': 'Item-1', 'price': 101.1},{'name': 'Item-2', 'price': 555.22}],1)==[{'name': 'Item-2', 'price': 555.22}]
`... |
Mbpp/586 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to split a list at the nth eelment and add the first part to the end
assert split_Arr([12,10,5,6,52,36],2) == [5,6,52,36,12,10]
```
### Answer:
Below is a Python script with a self-conta... |
Mbpp/587 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to convert a list to a tuple
assert list_tuple([5, 10, 7, 4, 15, 3])==(5, 10, 7, 4, 15, 3)
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and pa... |
Mbpp/588 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the difference between largest and smallest value in a given list
assert big_diff([1,2,3,4]) == 3
```
### Answer:
Below is a Python script with a self-contained function that sol... |
Mbpp/589 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find perfect squares between two given numbers
assert perfect_squares(1,30)==[1, 4, 9, 16, 25]
```
### Answer:
Below is a Python script with a self-contained function that solves the problem... |
Mbpp/590 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to convert polar coordinates to rectangular coordinates
assert polar_rect(3,4)==((5.0, 0.9272952180016122), (-2+2.4492935982947064e-16j))
```
### Answer:
Below is a Python script with a self-co... |
Mbpp/591 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to interchange the first and last elements in a list
assert swap_List([12, 35, 9, 56, 24]) == [24, 35, 9, 56, 12]
```
### Answer:
Below is a Python script with a self-contained function ... |
Mbpp/592 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the sum of the product of consecutive binomial co-efficients
assert sum_Of_product(3) == 15
```
### Answer:
Below is a Python script with a self-contained function that solves th... |
Mbpp/593 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to remove leading zeroes from an ip address
assert removezero_ip("216.08.094.196")==('216.8.94.196')
```
### Answer:
Below is a Python script with a self-contained function that solves the prob... |
Mbpp/594 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the difference of the first even and first odd number of a given list
assert diff_even_odd([1,3,5,7,4,1,6,8])==3
```
### Answer:
Below is a Python script with a self-contained function ... |
Mbpp/596 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the size in bytes of the given tuple
assert tuple_size(("A", 1, "B", 2, "C", 3) ) == sys.getsizeof(("A", 1, "B", 2, "C", 3))
```
### Answer:
Below is a Python script with a self-contain... |
Mbpp/597 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find kth element from the given two sorted arrays
assert find_kth([2, 3, 6, 7, 9], [1, 4, 8, 10], 5) == 6
```
### Answer:
Below is a Python script with a self-contained function that solves ... |
Mbpp/598 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to check whether the given number is armstrong or not
assert armstrong_number(153)==True
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and pass... |
Mbpp/599 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find sum and average of first n natural numbers
assert sum_average(10)==(55, 5.5)
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes c... |
Mbpp/600 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to check whether the given number is even or not
assert is_Even(1) == False
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes cor... |
Mbpp/602 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the first repeated character in a given string
assert first_repeated_char("abcabc") == "a"
```
### Answer:
Below is a Python script with a self-contained function that solves the... |
Mbpp/603 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to get all lucid numbers smaller than or equal to a given integer
assert get_ludic(10) == [1, 2, 3, 5, 7]
```
### Answer:
Below is a Python script with a self-contained function that solves the... |
Mbpp/604 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to reverse words seperated by spaces in a given string
assert reverse_words("python program")==("program python")
```
### Answer:
Below is a Python script with a self-contained function that so... |
Mbpp/605 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to check if the given integer is a prime number
assert prime_num(13)==True
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes correspondi... |
Mbpp/606 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to convert degrees to radians
assert radian_degree(90)==1.5707963267948966
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes correspondi... |
Mbpp/607 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to search a string for a regex pattern
assert find_literals('The quick brown fox jumps over the lazy dog.', 'fox') == ('fox', 16, 19)
```
### Answer:
Below is a Python script with a self-contai... |
Mbpp/608 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find nth bell number
assert bell_Number(2) == 2
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes corresponding tests:
```pyth... |
Mbpp/610 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function which takes a list and returns a list with the same elements, but the k'th element removed
assert remove_kth_element([1,1,2,3,4,4,5,1],3)==[1, 1, 3, 4, 4, 5, 1]
```
### Answer:
Below is ... |
Mbpp/611 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function which given a matrix represented as a list of lists returns the max of the n'th column
assert max_of_nth([[5, 6, 7], [1, 3, 5], [8, 9, 19]], 2) == 19
```
### Answer:
Below is a Python script wi... |
Mbpp/612 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
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 se... |
Mbpp/614 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the cumulative sum of all the values that are present in the given tuple list
assert cummulative_sum([(1, 3), (5, 6, 7), (2, 6)]) == 30
```
### Answer:
Below is a Python script with a s... |
Mbpp/615 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function which takes a tuple of tuples and returns the average value for each tuple as a list
assert average_tuple(((10, 10, 10, 12), (30, 45, 56, 45), (81, 80, 39, 32), (1, 2, 3, 4)))==[30.5, 34.25, 27... |
Mbpp/616 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function which takes two tuples of the same length and performs the element wise modulo
assert tuple_modulo((10, 4, 5, 6), (5, 6, 7, 5)) == (0, 4, 5, 1)
```
### Answer:
Below is a Python script with a s... |
Mbpp/618 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to divide two lists element wise
assert div_list([4,5,6],[1, 2, 3])==[4.0,2.5,2.0]
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes cor... |
Mbpp/619 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to move all the numbers to the end of the given string
assert move_num('I1love143you55three3000thousand') == 'Iloveyouthreethousand1143553000'
```
### Answer:
Below is a Python script with a se... |
Mbpp/620 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the size of the largest subset of a list of numbers so that every pair is divisible
assert largest_subset([ 1, 3, 6, 13, 17, 18 ]) == 4
```
### Answer:
Below is a Python script with a s... |
Mbpp/622 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to find the median of two sorted lists of same size
assert get_median([1, 12, 15, 26, 38], [2, 13, 17, 30, 45], 5) == 16.0
```
### Answer:
Below is a Python script with a self-contained functio... |
Mbpp/623 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to compute the n-th power of each number in a list
assert nth_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],2)==[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
```
### Answer:
Below is a Python script with a sel... |
Mbpp/624 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to convert a given string to uppercase
assert is_upper("person") =="PERSON"
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes cor... |
Mbpp/626 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the area of the largest triangle that can be inscribed in a semicircle with a given radius
assert triangle_area(-1) == None
```
### Answer:
Below is a Python script with a self-c... |
Mbpp/628 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to replace all spaces in the given string with '%20'
assert replace_spaces("My Name is Dawood") == 'My%20Name%20is%20Dawood'
```
### Answer:
Below is a Python script with a self-contained funct... |
Mbpp/629 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find even numbers from a list of numbers
assert Split([1,2,3,4,5]) == [2,4]
```
### Answer:
Below is a Python script with a self-contained function that solves the problem and passes ... |
Mbpp/630 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to extract all the adjacent coordinates of the given coordinate tuple
assert get_coordinates((3, 4)) == [[2, 3], [2, 4], [2, 5], [3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5]]
```
### Answer:
... |
Mbpp/631 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to replace whitespaces with an underscore and vice versa in a given string
assert replace_spaces('Jumanji The Jungle') == 'Jumanji_The_Jungle'
```
### Answer:
Below is a Python script with a se... |
Mbpp/632 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to move all zeroes to the end of the given list
assert move_zero([1,0,2,0,3,4]) == [1,2,3,4,0,0]
```
### Answer:
Below is a Python script with a self-contained function that solves the p... |
Mbpp/633 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a python function to find the sum of xor of all pairs of numbers in the given list
assert pair_xor_Sum([5,9,7,6],4) == 47
```
### Answer:
Below is a Python script with a self-contained function that solve... |
Mbpp/635 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to sort the given list
assert heap_sort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])==[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
```
### Answer:
Below is a Python script with a self-contained function that solves the p... |
Mbpp/637 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
Write a function to check whether the given amount has no profit and no loss
assert noprofit_noloss(1500,1200)==False
```
### Answer:
Below is a Python script with a self-contained function that solves the prob... |
Mbpp/638 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
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
assert wind_chill(120,35)==40
```
### Answer:
Below is a Python script... |
Mbpp/639 | Please provide a self-contained Python script that solves the following problem in a markdown code block:
```
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
assert sample_nam(['sally', 'Dylan', 'rebecca', 'Diana', 'Joanne', 'keith'])=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.