Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to convert the given snake case string to camel case string.

Tests:
assert snake_to_camel('android_tv') == 'AndroidTv'
assert snake_to_camel('google_pixel') == 'GooglePixel'
assert snake_to_camel('apple_watch') == 'AppleWatch'

import re
def snake_to_camel(word):
  return ''.join(x.capitalize() or '_' for x in word.split('_'))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to remove odd numbers from a given list.

Tests:
assert remove_odd([1,2,3]) == [2]
assert remove_odd([2,4,6]) == [2,4,6]
assert remove_odd([10,20,3]) == [10,20]

def remove_odd(l):
    for i in l:
        if i % 2 != 0:
            l.remove(i)
    return l


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to extract the nth element from a given list of tuples.

Tests:
assert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,0)==['Greyson Fulton', 'Brady Kent', 'Wyatt Knott', 'Beau Turnbull']
assert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,2)==[99, 96, 94, 98]
assert extract_nth_element([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)],1)==[98, 97, 91, 94]

def extract_nth_element(list1, n):
    result = [x[n] for x in list1]
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to check whether any value in a sequence exists in a sequence or not.

Tests:
assert overlapping([1,2,3,4,5],[6,7,8,9]) == False
assert overlapping([1,2,3],[4,5,6]) == False
assert overlapping([1,4,5],[1,4,5]) == True

def overlapping(list1,list2):
    for i in range(len(list1)):
        for j in range(len(list2)):
            if(list1[i]==list2[j]):
                return True
    return False


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find a pair with highest product from a given array of integers.

Tests:
assert max_Product([1,2,3,4,7,0,8,4]) == (7,8)
assert max_Product([0,-1,-2,-4,5,0,-6]) == (-4,-6)
assert max_Product([1,2,3]) == (2,3)

def max_Product(arr):
    arr_len = len(arr)
    if (arr_len < 2):
        return ("No pairs exists")
    x = arr[0]; y = arr[1]
    for i in range(0,arr_len):
        for j in range(i + 1,arr_len):
            if (arr[i] * arr[j] > x * y):
                x = arr[i]; y = arr[j]
    return x,y


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find common first element in given list of tuple.

Tests:
assert group_tuples([('x', 'y'), ('x', 'z'), ('w', 't')]) == [('x', 'y', 'z'), ('w', 't')]
assert group_tuples([('a', 'b'), ('a', 'c'), ('d', 'e')]) == [('a', 'b', 'c'), ('d', 'e')]
assert group_tuples([('f', 'g'), ('f', 'g'), ('h', 'i')]) == [('f', 'g', 'g'), ('h', 'i')]

def group_tuples(Input):
	out = {}
	for elem in Input:
		try:
			out[elem[0]].extend(elem[1:])
		except KeyError:
			out[elem[0]] = list(elem)
	return [tuple(values) for values in out.values()]


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the element of a list having maximum length.

Tests:
assert Find_Max([['A'],['A','B'],['A','B','C']]) == ['A','B','C']
assert Find_Max([[1],[1,2],[1,2,3]]) == [1,2,3]
assert Find_Max([[1,1],[1,2,3],[1,5,6,1]]) == [1,5,6,1]

def Find_Max(lst):
    maxList = max((x) for x in lst)
    return maxList


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list.

Tests:
assert round_and_sum([22.4, 4.0, -16.22, -9.10, 11.00, -12.22, 14.20, -5.20, 17.50])==243
assert round_and_sum([5,2,9,24.3,29])==345
assert round_and_sum([25.0,56.7,89.2])==513

def round_and_sum(list1):
  lenght=len(list1)
  round_and_sum=sum(list(map(round,list1))* lenght)
  return round_and_sum


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the cube sum of first n even natural numbers.

Tests:
assert cube_Sum(2) == 72
assert cube_Sum(3) == 288
assert cube_Sum(4) == 800

def cube_Sum(n):
    sum = 0
    for i in range(1,n + 1):
        sum += (2*i)*(2*i)*(2*i)
    return sum


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to concatenate each element of tuple by the delimiter.

Tests:
assert concatenate_tuple(("ID", "is", 4, "UTS") ) == 'ID-is-4-UTS'
assert concatenate_tuple(("QWE", "is", 4, "RTY") ) == 'QWE-is-4-RTY'
assert concatenate_tuple(("ZEN", "is", 4, "OP") ) == 'ZEN-is-4-OP'

def concatenate_tuple(test_tup):
    delim = "-"
    res = ''.join([str(ele) + delim for ele in test_tup])
    res = res[ : len(res) - len(delim)]
    return (str(res))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the average of cubes of first n natural numbers.

Tests:
assert find_Average_Of_Cube(2) == 4.5
assert find_Average_Of_Cube(3) == 12
assert find_Average_Of_Cube(1) == 1

def find_Average_Of_Cube(n):
    sum = 0
    for i in range(1, n + 1):
        sum += i * i * i
    return round(sum / n, 6)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to extract only the rear index element of each string in the given tuple.

Tests:
assert extract_rear(('Mers', 'for', 'Vers') ) == ['s', 'r', 's']
assert extract_rear(('Avenge', 'for', 'People') ) == ['e', 'r', 'e']
assert extract_rear(('Gotta', 'get', 'go') ) == ['a', 't', 'o']

def extract_rear(test_tuple):
  res = list(sub[len(sub) - 1] for sub in test_tuple)
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to count the number of sublists containing a particular element.

Tests:
assert count_element_in_list([[1, 3], [5, 7], [1, 11], [1, 15, 7]],1)==3
assert count_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'A')==3
assert count_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'E')==1

def count_element_in_list(list1, x):
    ctr = 0
    for i in range(len(list1)):
        if x in list1[i]:
            ctr+= 1
    return ctr


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to filter odd numbers.

Tests:
assert filter_oddnumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1,3,5,7,9]
assert filter_oddnumbers([10,20,45,67,84,93])==[45,67,93]
assert filter_oddnumbers([5,7,9,8,6,4,3])==[5,7,9,3]

def filter_oddnumbers(nums):
 odd_nums = list(filter(lambda x: x%2 != 0, nums))
 return odd_nums

Write a function to filter odd numbers.


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format.

Tests:
assert change_date_format("2026-01-02") == '02-01-2026'
assert change_date_format("2020-11-13") == '13-11-2020'
assert change_date_format("2021-04-26") == '26-04-2021'


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to sort the given array by using shell sort.

Tests:
assert shell_sort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) == [2, 3, 4, 5, 12, 12, 23, 56, 81, 95]
assert shell_sort([24, 22, 39, 34, 87, 73, 68]) == [22, 24, 34, 39, 68, 73, 87]
assert shell_sort([32, 30, 16, 96, 82, 83, 74]) == [16, 30, 32, 74, 82, 83, 96]

def shell_sort(my_list):
    gap = len(my_list) // 2
    while gap > 0:
        for i in range(gap, len(my_list)):
            current_item = my_list[i]
            j = i
            while j >= gap and my_list[j - gap] > current_item:
                my_list[j] = my_list[j - gap]
                j -= gap
            my_list[j] = current_item
        gap //= 2

    return my_list


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to extract the elementwise and tuples from the given two tuples.

Tests:
assert and_tuples((10, 4, 6, 9), (5, 2, 3, 3)) == (0, 0, 2, 1)
assert and_tuples((1, 2, 3, 4), (5, 6, 7, 8)) == (1, 2, 3, 0)
assert and_tuples((8, 9, 11, 12), (7, 13, 14, 17)) == (0, 9, 10, 0)

def and_tuples(test_tup1, test_tup2):
  res = tuple(ele1 & ele2 for ele1, ele2 in zip(test_tup1, test_tup2))
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the directrix of a parabola.

Tests:
assert parabola_directrix(5,3,2)==-198
assert parabola_directrix(9,8,4)==-2336
assert parabola_directrix(2,4,6)==-130

def parabola_directrix(a, b, c):
  directrix=((int)(c - ((b * b) + 1) * 4 * a ))
  return directrix


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function that takes two lists and returns true if they have at least one common element.

Tests:
assert common_element([1,2,3,4,5], [5,6,7,8,9])==True
assert common_element([1,2,3,4,5], [6,7,8,9])==None
assert common_element(['a','b','c'], ['d','b','e'])==True

def common_element(list1, list2):
     result = False
     for x in list1:
         for y in list2:
             if x == y:
                 result = True
                 return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the median length of a trapezium.

Tests:
assert median_trapezium(15,25,35)==20
assert median_trapezium(10,20,30)==15
assert median_trapezium(6,9,4)==7.5

def median_trapezium(base1,base2,height):
 median = 0.5 * (base1+ base2)
 return median


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to check whether the entered number is greater than the elements of the given array.

Tests:
assert check_greater([1, 2, 3, 4, 5], 4) == False
assert check_greater([2, 3, 4, 5, 6], 8) == True
assert check_greater([9, 7, 4, 8, 6, 1], 11) == True

def check_greater(arr, number):
  arr.sort()
  return number > arr[-1]


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function that matches a string that has an a followed by one or more b's.

Tests:
assert text_match_one("ac")==False
assert text_match_one("dc")==False
assert text_match_one("abba")==True

import re
def text_match_one(text):
        patterns = 'ab+?'
        if re.search(patterns,  text):
                return True
        else:
                return False


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the last digit of a given number.

Tests:
assert last_Digit(123) == 3
assert last_Digit(25) == 5
assert last_Digit(30) == 0


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to return the negative numbers in a list.

Tests:
assert neg_nos([-1,4,5,-6]) == [-1,-6]
assert neg_nos([-1,-2,3,4]) == [-1,-2]
assert neg_nos([-7,-6,8,9]) == [-7,-6]

def neg_nos(list1):
  out = []
  for num in list1:
    if num < 0:
      out.append(num)
  return out


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to remove odd characters in a string.

Tests:
assert remove_odd("python")==("yhn")
assert remove_odd("program")==("rga")
assert remove_odd("language")==("agae")

def remove_odd(str1):
 str2 = ''
 for i in range(1, len(str1) + 1):
    if(i % 2 == 0):
        str2 = str2 + str1[i - 1]
 return str2


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to count bidirectional tuple pairs.

Tests:
assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 3
assert count_bidirectional([(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 2
assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 2), (6, 5), (2, 1)] ) == 4

def count_bidirectional(test_list):
  res = 0
  for idx in range(0, len(test_list)):
    for iidx in range(idx + 1, len(test_list)):
      if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]:
        res += 1
  return res


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to join a list of multiple integers into a single integer.

Tests:
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

def multiple_to_single(L):
  x = int("".join(map(str, L)))
  return x


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the first adverb and their positions in a given sentence.

Tests:
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 re
def find_adverb_position(text):
 for m in re.finditer(r"\w+ly", text):
    return (m.start(), m.end(), m.group(0))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the surface area of a cube of a given size.

Tests:
assert surfacearea_cube(5)==150
assert surfacearea_cube(3)==54
assert surfacearea_cube(10)==600

def surfacearea_cube(l):
  surfacearea= 6*l*l
  return surfacearea


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the ration of positive numbers in an array of integers.

Tests:
assert positive_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8])==0.54
assert positive_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==0.69
assert positive_count([2, 4, -6, -9, 11, -12, 14, -5, 17])==0.56

from array import array
def positive_count(nums):
    n = len(nums)
    n1 = 0
    for x in nums:
        if x > 0:
            n1 += 1
        else:
          None
    return round(n1/n,2)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the largest negative number from the given list.

Tests:
assert largest_neg([1,2,3,-4,-6]) == -6
assert largest_neg([1,2,3,-8,-9]) == -9
assert largest_neg([1,2,3,4,-1]) == -1

def largest_neg(list1):
    max = list1[0]
    for x in list1:
        if x < max :
             max = x
    return max


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to trim each tuple by k in the given tuple list.

Tests:
assert trim_tuple([(5, 3, 2, 1, 4), (3, 4, 9, 2, 1),(9, 1, 2, 3, 5), (4, 8, 2, 1, 7)], 2) == '[(2,), (9,), (2,), (2,)]'
assert trim_tuple([(5, 3, 2, 1, 4), (3, 4, 9, 2, 1), (9, 1, 2, 3, 5), (4, 8, 2, 1, 7)], 1) == '[(3, 2, 1), (4, 9, 2), (1, 2, 3), (8, 2, 1)]'
assert trim_tuple([(7, 8, 4, 9), (11, 8, 12, 4),(4, 1, 7, 8), (3, 6, 9, 7)], 1) == '[(8, 4), (8, 12), (1, 7), (6, 9)]'

def trim_tuple(test_list, K):
  res = []
  for ele in test_list:
    N = len(ele)
    res.append(tuple(list(ele)[K: N - K]))
  return (str(res))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to perform index wise multiplication of tuple elements in the given two tuples.

Tests:
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_multiplication(((3, 5), (6, 7), (4, 11), (3, 12)),((8, 9), (5, 11), (3, 3), (9, 5)) ) == ((24, 45), (30, 77), (12, 33), (27, 60))

def index_multiplication(test_tup1, test_tup2):
  res = tuple(tuple(a * b for a, b in zip(tup1, tup2))
   for tup1, tup2 in zip(test_tup1, test_tup2))
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to count the occurence of all elements of list in a tuple.

Tests:
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

from collections import Counter
def count_Occurrence(tup, lst):
    count = 0
    for item in tup:
        if item in lst:
            count+= 1
    return count


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find cubes of individual elements in a list.

Tests:
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])

def cube_nums(nums):
 cube_nums = list(map(lambda x: x ** 3, nums))
 return cube_nums


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to calculate the sum of perrin numbers.

Tests:
assert cal_sum(9) == 49
assert cal_sum(10) == 66
assert cal_sum(11) == 88

def cal_sum(n):
	a = 3
	b = 0
	c = 2
	if (n == 0):
		return 3
	if (n == 1):
		return 3
	if (n == 2):
		return 5
	sum = 5
	while (n > 2):
		d = a + b
		sum = sum + d
		a = b
		b = c
		c = d
		n = n-1
	return sum


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to extract specified size of strings from a given list of string values.

Tests:
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']

def extract_string(str, l):
    result = [e for e in str if len(e) == l]
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to remove all whitespaces from the given string.

Tests:
assert remove_whitespaces(' Google    Flutter ') == 'GoogleFlutter'
assert remove_whitespaces(' Google    Dart ') == 'GoogleDart'
assert remove_whitespaces(' iOS    Swift ') == 'iOSSwift'

import re
def remove_whitespaces(text1):
  return (re.sub(r'\s+', '',text1))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function that gives loss amount on a sale if the given amount has loss else return 0.

Tests:
assert loss_amount(1500,1200)==0
assert loss_amount(100,200)==100
assert loss_amount(2000,5000)==3000

def loss_amount(actual_cost,sale_amount):
  if(sale_amount > actual_cost):
    amount = sale_amount - actual_cost
    return amount
  else:
    return 0


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the sum of even factors of a number.

Tests:
assert sumofFactors(18) == 26
assert sumofFactors(30) == 48
assert sumofFactors(6) == 8

import math
def sumofFactors(n) :
    if (n % 2 != 0) :
        return 0
    res = 1
    for i in range(2, (int)(math.sqrt(n)) + 1) :
        count = 0
        curr_sum = 1
        curr_term = 1
        while (n % i == 0) :
            count= count + 1
            n = n // i
            if (i == 2 and count == 1) :
                curr_sum = 0
            curr_term = curr_term * i
            curr_sum = curr_sum + curr_term
        res = res * curr_sum
    if (n >= 2) :
        res = res * (1 + n)
    return res


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function that matches a word containing 'z'.

Tests:
assert text_match_wordz("pythonz.")==True
assert text_match_wordz("xyz.")==True
assert text_match_wordz("  lang  .")==False

import re
def text_match_wordz(text):
        patterns = '\w*z.\w*'
        if re.search(patterns,  text):
                return True
        else:
                return False


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to check whether the given month number contains 31 days or not.

Tests:
assert check_monthnumb_number(5)==True
assert check_monthnumb_number(2)==False
assert check_monthnumb_number(6)==False

def check_monthnumb_number(monthnum2):
  if(monthnum2==1 or monthnum2==3 or monthnum2==5 or monthnum2==7 or monthnum2==8 or monthnum2==10 or monthnum2==12):
    return True
  else:
    return False


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to reverse each string in a given list of string values.

Tests:
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']

def reverse_string_list(stringlist):
    result = [x[::-1] for x in stringlist]
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the sublist having minimum length.

Tests:
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']

def Find_Min(lst):
    return min(lst, key=len)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the area of a rectangle.

Tests:
assert rectangle_area(10,20)==200
assert rectangle_area(10,5)==50
assert rectangle_area(4,2)==8

def rectangle_area(l,b):
  area=l*b
  return area


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to remove uppercase substrings from a given string.

Tests:
assert remove_uppercase('cAstyoUrFavoRitETVshoWs') == 'cstyoravoitshos'
assert remove_uppercase('wAtchTheinTernEtrAdIo') == 'wtchheinerntrdo'
assert remove_uppercase('VoicESeaRchAndreComMendaTionS') == 'oiceachndreomendaion'

import re
def remove_uppercase(str1):
  return re.sub('[A-Z]', '', str1)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to get the first element of each sublist.

Tests:
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]

def Extract(lst):
    return [item[0] for item in lst]


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to count the upper case characters in a given string.

Tests:
assert upper_ctr('PYthon') == 1
assert upper_ctr('BigData') == 1
assert upper_ctr('program') == 0

def upper_ctr(str):
    upper_ctr = 0
    for i in range(len(str)):
          if str[i] >= 'A' and str[i] <= 'Z': upper_ctr += 1
          return upper_ctr


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find all possible combinations of the elements of a given list.

Tests:
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', 'green', 'red'], ['blue', 'green', 'red', 'orange']]
assert combinations_list(['red', 'green', 'blue', 'white', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]
assert combinations_list(['red', 'green', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]

def combinations_list(list1):
    if len(list1) == 0:
        return [[]]
    result = []
    for el in combinations_list(list1[1:]):
        result += [el, el+[list1[0]]]
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the maximum product subarray of the given array.

Tests:
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

def max_subarray_product(arr):
	n = len(arr)
	max_ending_here = 1
	min_ending_here = 1
	max_so_far = 0
	flag = 0
	for i in range(0, n):
		if arr[i] > 0:
			max_ending_here = max_ending_here * arr[i]
			min_ending_here = min (min_ending_here * arr[i], 1)
			flag = 1
		elif arr[i] == 0:
			max_ending_here = 1
			min_ending_here = 1
		else:
			temp = max_ending_here
			max_ending_here = max (min_ending_here * arr[i], 1)
			min_ending_here = temp * arr[i]
		if (max_so_far < max_ending_here):
			max_so_far = max_ending_here
	if flag == 0 and max_so_far == 0:
		return 0
	return max_so_far


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to check if all values are same in a dictionary.

Tests:
assert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},10)==False
assert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},12)==True
assert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},5)==False

def check_value(dict, n):
    result = all(x == n for x in dict.values())
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to drop empty items from a given dictionary.

Tests:
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'}

def drop_empty(dict1):
  dict1 = {key:value for (key, value) in dict1.items() if value is not None}
  return dict1


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.

Tests:
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

def max_product(arr):
  n = len(arr)
  mpis = arr[:]
  for i in range(n):
    current_prod = arr[i]
    j = i + 1
    while j < n:
      if arr[j-1] > arr[j]:
        break
      current_prod *= arr[j]
      if current_prod > mpis[j]:
        mpis[j] = current_prod
      j = j + 1
  return max(mpis)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the pairwise addition of the neighboring elements of the given tuple.

Tests:
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)

def add_pairwise(test_tup):
  res = tuple(i + j for i, j in zip(test_tup, test_tup[1:]))
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the product of the array multiplication modulo n.

Tests:
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

def find_remainder(arr, n):
    mul = 1
    for i in range(len(arr)):
        mul = (mul * (arr[i] % n)) % n
    return mul % n


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to check whether the given list contains consecutive numbers or not.

Tests:
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

def check_Consecutive(l):
    return sorted(l) == list(range(min(l),max(l)+1))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order.

Tests:
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)] , [(11, 2), (2, 3), (6, 2), (1, 3)]) == {(1, 3), (2, 3)}

def tuple_intersection(test_list1, test_list2):
  res = set([tuple(sorted(ele)) for ele in test_list1]) & set([tuple(sorted(ele)) for ele in test_list2])
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to replace characters in a string.

Tests:
assert replace_char("polygon",'y','l')==("pollgon")
assert replace_char("character",'c','a')==("aharaater")
assert replace_char("python",'l','a')==("python")

def replace_char(str1,ch,newch):
 str2 = str1.replace(ch, newch)
 return str2


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to sort a dictionary by value.

Tests:
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})==[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)]

from collections import Counter
def sort_counter(dict1):
 x = Counter(dict1)
 sort_counter=x.most_common()
 return sort_counter


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the sum of the largest and smallest value in a given array.

Tests:
assert big_sum([1,2,3]) == 4
assert big_sum([-1,2,3,4]) == 3
assert big_sum([2,3,6]) == 8

def big_sum(nums):
      sum= max(nums)+min(nums)
      return sum


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to convert the given string to lower case.

Tests:
assert is_lower("InValid") == "invalid"
assert is_lower("TruE") == "true"
assert is_lower("SenTenCE") == "sentence"

def is_lower(string):
  return (string.lower())


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to remove lowercase substrings from a given string.

Tests:
assert remove_lowercase("PYTHon")==('PYTH')
assert remove_lowercase("FInD")==('FID')
assert remove_lowercase("STRinG")==('STRG')

import re
def remove_lowercase(str1):
 return re.sub('[a-z]', '', str1)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the first digit of a given number.

Tests:
assert first_Digit(123) == 1
assert first_Digit(456) == 4
assert first_Digit(12) == 1

def first_Digit(n) :
    while n >= 10:
        n = n / 10
    return int(n)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function which takes a list of integers and only returns the odd ones.

Tests:
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]

def Split(list):
    od_li = []
    for i in list:
        if (i % 2 != 0):
            od_li.append(i)
    return od_li


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
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.

Tests:
assert difference(3) == 30
assert difference(5) == 210
assert difference(2) == 6

def difference(n) :
    S = (n*(n + 1))//2;
    res = S*(S-1);
    return res;


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to count the number of pairs whose xor value is odd.

Tests:
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

def find_Odd_Pair(A,N) :
    oddPair = 0
    for i in range(0,N) :
        for j in range(i+1,N) :
            if ((A[i] ^ A[j]) % 2 != 0):
                oddPair+=1
    return oddPair


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to toggle the case of all characters in a string.

Tests:
assert toggle_string("Python")==("pYTHON")
assert toggle_string("Pangram")==("pANGRAM")
assert toggle_string("LIttLE")==("liTTle")

def toggle_string(string):
 string1 = string.swapcase()
 return string1


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the sum of the per-digit difference between two integers.

Tests:
assert digit_distance_nums(1,2) == 1
assert digit_distance_nums(23,56) == 6
assert digit_distance_nums(123,256) == 7

def digit_distance_nums(n1, n2):
         return sum(map(int,str(abs(n1-n2))))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the sum of the largest contiguous sublist in the given list.

Tests:
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

def max_sub_array_sum(a, size):
  max_so_far = 0
  max_ending_here = 0
  for i in range(0, size):
    max_ending_here = max_ending_here + a[i]
    if max_ending_here < 0:
      max_ending_here = 0
    elif (max_so_far < max_ending_here):
      max_so_far = max_ending_here
  return max_so_far


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the union of the elements of two given tuples and output them in sorted order.

Tests:
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)

def union_elements(test_tup1, test_tup2):
  res = tuple(set(test_tup1 + test_tup2))
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the length of the longest sublists.

Tests:
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

def Find_Max_Length(lst):
    maxLength = max(len(x) for x in lst )
    return maxLength


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to extract values between quotation marks from a string.

Tests:
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 re
def extract_values(text):
 return (re.findall(r'"(.*?)"', text))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function which takes a list of integers and counts the number of possible unordered pairs where both elements are unequal.

Tests:
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

def count_Pairs(arr,n):
    cnt = 0;
    for i in range(n):
        for j in range(i + 1,n):
            if (arr[i] != arr[j]):
                cnt += 1;
    return cnt;


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to split a string into characters.

Tests:
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']

def split(word):
    return [char for char in word]


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to get the sum of the digits of a non-negative integer.

Tests:
assert sum_digits(345)==12
assert sum_digits(12)==3
assert sum_digits(97)==16

def sum_digits(n):
  if n == 0:
    return 0
  else:
    return n % 10 + sum_digits(int(n / 10))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to check whether a specified list is sorted or not.

Tests:
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

def issort_list(list1):
    result = all(list1[i] <= list1[i+1] for i in range(len(list1)-1))
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to create a list of N empty dictionaries.

Tests:
assert empty_list(5)==[{},{},{},{},{}]
assert empty_list(6)==[{},{},{},{},{},{}]
assert empty_list(7)==[{},{},{},{},{},{},{}]

def empty_list(length):
 empty_list = [{} for _ in range(length)]
 return empty_list


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to sort each sublist of strings in a given list of lists.

Tests:
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'], ['white']]
assert sort_sublists([['a','b'],['d','c'],['g','h'] , ['f','e']])==[['a', 'b'], ['c', 'd'], ['g', 'h'], ['e', 'f']]

def sort_sublists(list1):
    result = list(map(sorted,list1))
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to remove duplicate numbers from a given number of lists.

Tests:
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]

def two_unique_nums(nums):
  return [i for i in nums if nums.count(i)==1]


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to calculate the product of the unique numbers in a given list.

Tests:
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

def unique_product(list_data):
    temp = list(set(list_data))
    p = 1
    for i in temp:
        p *= i
    return p


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the surface area of a cylinder.

Tests:
assert surfacearea_cylinder(10,5)==942.45
assert surfacearea_cylinder(4,5)==226.18800000000002
assert surfacearea_cylinder(4,10)==351.848

def surfacearea_cylinder(r,h):
  surfacearea=((2*3.1415*r*r) +(2*3.1415*r*h))
  return surfacearea


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to check whether a list is sublist of another or not.

Tests:
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

def is_Sub_Array(A,B):
    n = len(A)
    m = len(B)
    i = 0; j = 0;
    while (i < n and j < m):
        if (A[i] == B[j]):
            i += 1;
            j += 1;
            if (j == m):
                return True;
        else:
            i = i - j + 1;
            j = 0;
    return False;


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the last digit in factorial of a given number.

Tests:
assert last_Digit_Factorial(4) == 4
assert last_Digit_Factorial(21) == 0
assert last_Digit_Factorial(30) == 0

def last_Digit_Factorial(n):
    if (n == 0): return 1
    elif (n <= 2): return n
    elif (n == 3): return 6
    elif (n == 4): return 4
    else:
      return 0


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to interleave 3 lists of the same length into a single flat list.

Tests:
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,20,44,15,5]

def interleave_lists(list1,list2,list3):
    result = [el for pair in zip(list1, list2, list3) for el in pair]
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the dissimilar elements in the given two tuples.

Tests:
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)

def find_dissimilar(test_tup1, test_tup2):
  res = tuple(set(test_tup1) ^ set(test_tup2))
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to remove uneven elements in the nested mixed tuple.

Tests:
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)

def even_ele(test_tuple, even_fnc):
	res = tuple()
	for ele in test_tuple:
		if isinstance(ele, tuple):
			res += (even_ele(ele, even_fnc), )
		elif even_fnc(ele):
			res += (ele, )
	return res
def extract_even(test_tuple):
  res = even_ele(test_tuple, lambda x: x % 2 == 0)
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the surface area of a square pyramid with a given base edge and height.

Tests:
assert surface_Area(3,4) == 33
assert surface_Area(4,5) == 56
assert surface_Area(1,2) == 5

def surface_Area(b,s):
    return 2 * b * s + pow(b,2)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to check if a dictionary is empty

Tests:
assert my_dict({10})==False
assert my_dict({11})==False
assert my_dict({})==True

def my_dict(dict1):
  if bool(dict1):
     return False
  else:
     return True


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function which returns nth catalan number.

Tests:
assert catalan_number(10)==16796
assert catalan_number(9)==4862
assert catalan_number(7)==429

def catalan_number(num):
    if num <=1:
         return 1
    res_num = 0
    for i in range(num):
        res_num += catalan_number(i) * catalan_number(num-i-1)
    return res_num


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the first adverb ending with ly and its positions in a given string.

Tests:
assert find_adverbs("Clearly, he has no excuse for such behavior.") == '0-7: Clearly'
assert find_adverbs("Please handle the situation carefuly") == '28-36: carefuly'
assert find_adverbs("Complete the task quickly") == '18-25: quickly'

import re
def find_adverbs(text):
  for m in re.finditer(r"\w+ly", text):
    return ('%d-%d: %s' % (m.start(), m.end(), m.group(0)))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the n most expensive items in a given dataset.

Tests:
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},{'name': 'Item-1', 'price': 101.1}]
assert expensive_items([{'name': 'Item-1', 'price': 101.1},{'name': 'Item-2', 'price': 555.22}, {'name': 'Item-3', 'price': 45.09},{'name': 'Item-4', 'price': 22.75}],1)==[{'name': 'Item-2', 'price': 555.22}]

import heapq
def expensive_items(items,n):
  expensive_items = heapq.nlargest(n, items, key=lambda s: s['price'])
  return expensive_items


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to split a list at the nth eelment and add the first part to the end.

Tests:
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]

def split_Arr(l, n):
  return l[n:] + l[:n]


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to convert a list to a tuple.

Tests:
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)

def list_tuple(listx):
  tuplex = tuple(listx)
  return tuplex


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the difference between largest and smallest value in a given list.

Tests:
assert big_diff([1,2,3,4]) == 3
assert big_diff([4,5,12]) == 8
assert big_diff([9,2,3]) == 7

def big_diff(nums):
     diff= max(nums)-min(nums)
     return diff


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find perfect squares between two given numbers.

Tests:
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]

def perfect_squares(a, b):
    lists=[]
    for i in range (a,b+1):
        j = 1;
        while j*j <= i:
            if j*j == i:
                 lists.append(i)
            j = j+1
        i = i+1
    return lists


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to convert polar coordinates to rectangular coordinates.

Tests:
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 cmath
def polar_rect(x,y):
 cn = complex(x,y)
 cn=cmath.polar(cn)
 cn1 = cmath.rect(2, cmath.pi)
 return (cn,cn1)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to interchange the first and last elements in a list.

Tests:
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]

def swap_List(newList):
    size = len(newList)
    temp = newList[0]
    newList[0] = newList[size - 1]
    newList[size - 1] = temp
    return newList


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the sum of the product of consecutive binomial co-efficients.

Tests:
assert sum_Of_product(3) == 15
assert sum_Of_product(4) == 56
assert sum_Of_product(1) == 1

def binomial_Coeff(n,k):
    C = [0] * (k + 1);
    C[0] = 1; # nC0 is 1
    for i in range(1,n + 1):
        for j in range(min(i, k),0,-1):
            C[j] = C[j] + C[j - 1];
    return C[k];
def sum_Of_product(n):
    return binomial_Coeff(2 * n,n - 1);


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to remove leading zeroes from an ip address.

Tests:
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 re
def removezero_ip(ip):
 string = re.sub('\.[0]*', '.', ip)
 return string


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the difference of the first even and first odd number of a given list.

Tests:
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

def diff_even_odd(list1):
    first_even = next((el for el in list1 if el%2==0),-1)
    first_odd = next((el for el in list1 if el%2!=0),-1)
    return (first_even-first_odd)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to count minimum number of swaps required to convert one binary number represented as a string to another.

Tests:
assert min_Swaps("1101","1110") == 1
assert min_Swaps("111","000") == "Not Possible"
assert min_Swaps("111","110") == "Not Possible"

def min_Swaps(str1,str2) :
    count = 0
    for i in range(len(str1)) :
        if str1[i] != str2[i] :
            count += 1
    if count % 2 == 0 :
        return (count // 2)
    else :
        return ("Not Possible")


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the size in bytes of the given tuple.

Tests:
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, "Wolf"))  ) == sys.getsizeof(((1, "Lion"), ( 2, "Tiger"), (3, "Fox"), (4, "Wolf")))

import sys
def tuple_size(tuple_list):
  return (sys.getsizeof(tuple_list))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find kth element from the given two sorted arrays.

Tests:
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

def find_kth(arr1, arr2, k):
	m = len(arr1)
	n = len(arr2)
	sorted1 = [0] * (m + n)
	i = 0
	j = 0
	d = 0
	while (i < m and j < n):
		if (arr1[i] < arr2[j]):
			sorted1[d] = arr1[i]
			i += 1
		else:
			sorted1[d] = arr2[j]
			j += 1
		d += 1
	while (i < m):
		sorted1[d] = arr1[i]
		d += 1
		i += 1
	while (j < n):
		sorted1[d] = arr2[j]
		d += 1
		j += 1
	return sorted1[k - 1]


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to check whether the given number is armstrong or not.

Tests:
assert armstrong_number(153)==True
assert armstrong_number(259)==False
assert armstrong_number(4458)==False

def armstrong_number(number):
 sum = 0
 times = 0
 temp = number
 while temp > 0:
           times = times + 1
           temp = temp // 10
 temp = number
 while temp > 0:
           reminder = temp % 10
           sum = sum + (reminder ** times)
           temp //= 10
 if number == sum:
           return True
 else:
           return False


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find sum and average of first n natural numbers.

Tests:
assert sum_average(10)==(55, 5.5)
assert sum_average(15)==(120, 8.0)
assert sum_average(20)==(210, 10.5)

def sum_average(number):
 total = 0
 for value in range(1, number + 1):
    total = total + value
 average = total / number
 return (total,average)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to check whether the given number is even or not.

Tests:
assert is_Even(1) == False
assert is_Even(2) == True
assert is_Even(3) == False

def is_Even(n) :
    if (n^1 == n+1) :
        return True;
    else :
        return False;


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the shared elements from the given two lists.

Tests:
assert set(similar_elements((3, 4, 5, 6),(5, 7, 4, 10))) == set((4, 5))
assert set(similar_elements((1, 2, 3, 4),(5, 4, 3, 7))) == set((3, 4))
assert set(similar_elements((11, 12, 14, 13),(17, 15, 14, 13))) == set((13, 14))

def similar_elements(test_tup1, test_tup2):
  res = tuple(set(test_tup1) & set(test_tup2))
  return (res)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to identify non-prime numbers.

Tests:
assert is_not_prime(2) == False
assert is_not_prime(10) == True
assert is_not_prime(35) == True
assert is_not_prime(37) == False

import math
def is_not_prime(n):
    result = False
    for i in range(2,int(math.sqrt(n)) + 1):
        if n % i == 0:
            result = True
    return result


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find the n largest integers from a given list of numbers, returned in descending order.

Tests:
assert heap_queue_largest( [25, 35, 22, 85, 14, 65, 75, 22, 58],3)==[85, 75, 65]
assert heap_queue_largest( [25, 35, 22, 85, 14, 65, 75, 22, 58],2)==[85, 75]
assert heap_queue_largest( [25, 35, 22, 85, 14, 65, 75, 22, 58],5)==[85, 75, 65, 58, 35]

import heapq as hq
def heap_queue_largest(nums,n):
  largest_nums = hq.nlargest(n, nums)
  return largest_nums


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to check whether the two numbers differ at one bit position only or not.

Tests:
assert differ_At_One_Bit_Pos(13,9) == True
assert differ_At_One_Bit_Pos(15,8) == False
assert differ_At_One_Bit_Pos(2,4) == False
assert differ_At_One_Bit_Pos(2, 3) == True
assert differ_At_One_Bit_Pos(5, 1) == True
assert differ_At_One_Bit_Pos(1, 5) == True

def is_Power_Of_Two (x):
    return x and (not(x & (x - 1)))
def differ_At_One_Bit_Pos(a,b):
    return is_Power_Of_Two(a ^ b)


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find all words which are at least 4 characters long in a string.

Tests:
assert set(find_char_long('Please move back to stream')) == set(['Please', 'move', 'back', 'stream'])
assert set(find_char_long('Jing Eco and Tech')) == set(['Jing', 'Tech'])
assert set(find_char_long('Jhingai wulu road Zone 3')) == set(['Jhingai', 'wulu', 'road', 'Zone'])

import re
def find_char_long(text):
  return (re.findall(r"\b\w{4,}\b", text))


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a function to find squares of individual elements in a list.

Tests:
assert square_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
assert square_nums([10,20,30])==([100,400,900])
assert square_nums([12,15])==([144,225])

def square_nums(nums):
 square_nums = list(map(lambda x: x ** 2, nums))
 return square_nums


Question:
Write a Python function that satisfies the following description. Return only the function definition(s); the function name and signature must match the tests below.

Description:
Write a python function to find the minimum number of rotations (greater than 0) required to get the same string.

Tests:
assert find_Rotations("aaaa") == 1
assert find_Rotations("ab") == 2
assert find_Rotations("abc") == 3

def find_Rotations(str):
    tmp = str + str
    n = len(str)
    for i in range(1,n + 1):
        substring = tmp[i: i+n]
        if (str == substring):
            return i
    return n