messages
listlengths
3
3
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the equilibrium index of the given array.\n\n", "role": "user" }, { "content": "def equilibrium_index(arr):\r\n total_...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the minimum number of elements that should be removed such that amax-amin<=k.\n\n", "role": "user" }, { "content": "def...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check whether the given key is present in the dictionary or not.\n\n", "role": "user" }, { "content": "def is_key_present(d,...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to calculate the harmonic sum of n-1.\n\n", "role": "user" }, { "content": "def harmonic_sum(n):\r\n if n < 2:\r\n return 1...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to sort a list of lists by length and value.\n\n", "role": "user" }, { "content": "def sort_sublists(list1):\r\n list1.sor...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find whether an array is subset of another array.\n\n", "role": "user" }, { "content": "def is_subset(arr1, m, arr2, n): \r\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to count the total set bits from 1 to n.\n\n", "role": "user" }, { "content": "def count_Set_Bits(n) : \r\n n += 1; ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to convert a string to a list.\n\n", "role": "user" }, { "content": "def Convert(string): \r\n li = list(string.split...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to count unique keys for each value present in the tuple.\n\n", "role": "user" }, { "content": "from collections import default...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to access the initial and last data of the given tuple record.\n\n", "role": "user" }, { "content": "def front_and_rear(test_tu...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to check whether the product of digits of a number at even and odd places is equal or not.\n\n", "role": "user" }, { "co...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to remove duplicates from a list of lists.\n\n", "role": "user" }, { "content": "import itertools\r\ndef remove_duplicate(list1...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check if the given tuple contains all valid values or not.\n\n", "role": "user" }, { "content": "def check_valid(test_tup):\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to count the number of distinct power of prime factor of given number.\n\n", "role": "user" }, { "content": "def count_F...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to convert the given string of integers into a tuple.\n\n", "role": "user" }, { "content": "def str_to_tuple(test_str):\r\n re...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the perimeter of a rombus.\n\n", "role": "user" }, { "content": "def rombus_perimeter(a):\r\n perimeter=4*a\r\n retur...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to calculate the standard deviation.\n\n", "role": "user" }, { "content": "import math\r\nimport sys\r\ndef sd_calc(data):\r\n ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to create a list taking alternate elements from another given list.\n\n", "role": "user" }, { "content": "def alternate_element...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function that matches a string that has an a followed by zero or more b's.\n\n", "role": "user" }, { "content": "import re\r\ndef text_m...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to add a dictionary to the tuple.\n\n", "role": "user" }, { "content": "def add_dict_to_tuple(test_tup, test_dict):\r\n test_t...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find a path with the maximum average over all existing paths for the given square matrix of size n*n.\n\n", "role": "user" }, { ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to filter the height and width of students which are stored in a dictionary.\n\n", "role": "user" }, { "content": "def filter_d...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to count the same pair in two given lists using map function.\n\n", "role": "user" }, { "content": "from operator import eq\r\n...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to calculate the sum of all digits of the base to the specified power.\n\n", "role": "user" }, { "content": "def power_base_sum...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to extract values between quotation marks of the given string by using regex.\n\n", "role": "user" }, { "content": "import re\r...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to multiply the adjacent elements of the given tuple.\n\n", "role": "user" }, { "content": "def multiply_elements(test_tup):\r\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to remove all characters except letters and numbers using regex\n\n", "role": "user" }, { "content": "import re \r\ndef remove_...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to sum elements in two lists.\n\n", "role": "user" }, { "content": "def sum_list(lst1,lst2):\r\n res_list = [lst1[i] + lst2[i]...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to add two lists using map and lambda function.\n\n", "role": "user" }, { "content": "def add_list(nums1,nums2):\r\n result = ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to remove consecutive duplicates of a given list.\n\n", "role": "user" }, { "content": "from itertools import groupby\r\ndef co...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the lateral surface area of a cone.\n\n", "role": "user" }, { "content": "import math\r\ndef lateralsurface_cone(r,h):\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to replace all occurrences of spaces, commas, or dots with a colon.\n\n", "role": "user" }, { "content": "import re\r\ndef repl...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the index of the first occurrence of a given number in a sorted array.\n\n", "role": "user" }, { "content": "def find_f...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find sum of products of all possible subarrays.\n\n", "role": "user" }, { "content": "def sum_Of_Subarray_Prod(arr,n)...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to toggle bits of the number except the first and the last bit.\n\n", "role": "user" }, { "content": "def set_middle_bit...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to locate the left insertion point for a specified value in sorted order.\n\n", "role": "user" }, { "content": "import bisect\r...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check whether the given string is starting with a vowel or not using regex.\n\n", "role": "user" }, { "content": "import re ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to calculate the geometric sum of n-1.\n\n", "role": "user" }, { "content": "def geometric_sum(n):\r\n if n < 0:\r\n return...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the index of smallest triangular number with n digits.\n\n", "role": "user" }, { "content": "import math \r\ndef...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to convert the given tuple to a key-value dictionary using adjacent elements.\n\n", "role": "user" }, { "content": "def tuple_t...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to check whether all the characters are same or not.\n\n", "role": "user" }, { "content": "def all_Characters_Same(s) :\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to caluclate the area of a tetrahedron.\n\n", "role": "user" }, { "content": "import math\r\ndef area_tetrahedron(side):\r\n a...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to rotate a given list by specified number of items to the right direction.\n\n", "role": "user" }, { "content": "def rotate_ri...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check if the given tuple has any none value or not.\n\n", "role": "user" }, { "content": "def check_none(test_tup):\r\n res...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find numbers within a given range where every number is divisible by every digit it contains.\n\n", "role": "user" }, { "con...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find area of a sector.\n\n", "role": "user" }, { "content": "def sector_area(r,a):\r\n pi=22/7\r\n if a >= 360:\r\n ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the longest common subsequence for the given three string sequence.\n\n", "role": "user" }, { "content": "def lcs_of_th...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to put spaces between words starting with capital letters in a given string by using regex.\n\n", "role": "user" }, { "content"...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to sort a given list of strings of numbers numerically.\n\n", "role": "user" }, { "content": "def sort_numeric_strings(nums_str...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to add the given tuple to the given list.\n\n", "role": "user" }, { "content": "def add_tuple(test_list, test_tup):\r\n test_l...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check if the given array represents min heap or not.\n\n", "role": "user" }, { "content": "def check_min_heap(arr, i):\r\n ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the nth jacobsthal number.\n\n", "role": "user" }, { "content": "def jacobsthal_num(n): \r\n\tdp = [0] * (n + 1) \r\n\t...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find minimum k records from tuple list.\n\n", "role": "user" }, { "content": "def min_k(test_list, K):\r\n res = sorted(tes...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find common index elements from three lists.\n\n", "role": "user" }, { "content": "def extract_index_list(l1, l2, l3):\r\n ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the second smallest number in a list.\n\n", "role": "user" }, { "content": "def second_smallest(numbers):\r\n if (len(...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function that matches a string that has an a followed by zero or one 'b'.\n\n", "role": "user" }, { "content": "import re\r\ndef text_ma...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to count the pairs of reverse strings in the given string list.\n\n", "role": "user" }, { "content": "def count_reverse_pairs(t...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to count number of unique lists within a list.\n\n", "role": "user" }, { "content": "def unique_sublists(list1):\r\n result ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check a decimal with a precision of 2.\n\n", "role": "user" }, { "content": "def is_decimal(num):\r\n import re\r\n dn...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to check whether an array contains only one distinct element or not.\n\n", "role": "user" }, { "content": "def unique_El...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to caluclate arc length of an angle.\n\n", "role": "user" }, { "content": "def arc_length(d,a):\r\n pi=22/7\r\n if a >= 3...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check whether the given month number contains 30 days or not.\n\n", "role": "user" }, { "content": "def check_monthnumber_nu...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the minimum difference between any two elements in a given array.\n\n", "role": "user" }, { "content": "def find...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to count numeric values in a given string.\n\n", "role": "user" }, { "content": "def number_ctr(str):\r\n number_ct...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find nth polite number.\n\n", "role": "user" }, { "content": "import math \r\ndef is_polite(n): \r\n\tn = n + 1\r\n\treturn ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to iterate over all pairs of consecutive items in a given list.\n\n", "role": "user" }, { "content": "def pair_wise(l1):\r\n ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to count the number of pairs whose sum is equal to ‘sum’.\n\n", "role": "user" }, { "content": "def get_Pairs_Count(arr,...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to check for odd parity of a given number.\n\n", "role": "user" }, { "content": "def check_Odd_Parity(x): \r\n parity...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to get the difference between two lists.\n\n", "role": "user" }, { "content": "def Diff(li1,li2):\r\n return (list(li...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the sum of fourth power of first n odd natural numbers.\n\n", "role": "user" }, { "content": "def odd_Num_Sum(n)...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check if the given expression is balanced or not.\n\n", "role": "user" }, { "content": "from collections import deque\r\ndef...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to remove all the words with k length in the given string.\n\n", "role": "user" }, { "content": "def remove_length(test_str, K)...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the occurrence and position of the substrings within a string.\n\n", "role": "user" }, { "content": "import re\r\ndef o...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to check if the string is a valid email address or not using regex.\n\n", "role": "user" }, { "content": "import re \r\nregex =...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to check whether every odd index contains odd numbers of a given list.\n\n", "role": "user" }, { "content": "def odd_pos...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to count those characters which have vowels as their neighbors in the given string.\n\n", "role": "user" }, { "content": "def c...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the sum of non-repeated elements in a given array.\n\n", "role": "user" }, { "content": "def find_Sum(arr,n): \r...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to pack consecutive duplicates of a given list elements into sublists.\n\n", "role": "user" }, { "content": "from itertools imp...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to count the number of unique lists within a list.\n\n", "role": "user" }, { "content": "def unique_sublists(list1):\r\n res...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the combinations of sums with tuples in the given tuple list.\n\n", "role": "user" }, { "content": "from itertools impo...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to check whether the count of divisors is even or odd.\n\n", "role": "user" }, { "content": "import math \r\ndef count_D...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the sum of all odd length subarrays.\n\n", "role": "user" }, { "content": "def Odd_Length_Sum(arr):\r\n Sum =...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to convert rgb color to hsv color.\n\n", "role": "user" }, { "content": "def rgb_to_hsv(r, g, b):\r\n r, g, b = r/255.0, g/2...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the product of first even and odd number of a given list.\n\n", "role": "user" }, { "content": "def mul_even_odd(list1)...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to convert tuple string to integer tuple.\n\n", "role": "user" }, { "content": "def tuple_str_int(test_str):\r\n res = tuple(i...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to locate the right insertion point for a specified value in sorted order.\n\n", "role": "user" }, { "content": "import bisect\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function that matches a string that has an a followed by three 'b'.\n\n", "role": "user" }, { "content": "import re\r\ndef text_match_th...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to create a new tuple from the given string and list.\n\n", "role": "user" }, { "content": "def new_tuple(test_list, test_str):...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to calculate the perimeter of a regular polygon.\n\n", "role": "user" }, { "content": "from math import tan, pi\r\ndef perimete...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to check whether every even index contains even numbers of a given list.\n\n", "role": "user" }, { "content": "def even_...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to remove the nested record from the given tuple.\n\n", "role": "user" }, { "content": "def remove_nested(test_tup):\r\n res =...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to count the number of lists in a given number of lists.\n\n", "role": "user" }, { "content": "def count_list(input_list...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the last position of an element in a sorted array.\n\n", "role": "user" }, { "content": "def last(arr,x,n):\r\n ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function that matches a string that has an 'a' followed by anything, ending in 'b'.\n\n", "role": "user" }, { "content": "import re\r\nd...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to find the n - cheap price items from a given dataset using heap queue algorithm.\n\n", "role": "user" }, { "content": "import...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite function to find the sum of all items in the given dictionary.\n\n", "role": "user" }, { "content": "def return_sum(dict):\r\n sum = 0\r\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the sum of all odd natural numbers within the range l and r.\n\n", "role": "user" }, { "content": "def sum_Odd(n...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to find the sum of an array.\n\n", "role": "user" }, { "content": "def _sum(arr): \r\n sum=0\r\n for i in arr: \r...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a python function to left rotate the bits of a given number.\n\n", "role": "user" }, { "content": "INT_BITS = 32\r\ndef left_Rotate(n,d): ...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to remove all whitespaces from a string.\n\n", "role": "user" }, { "content": "import re\r\ndef remove_all_spaces(text):\r\n re...