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 longest palindromic subsequence in the given string.\n\n",
"role": "user"
},
{
"content": "def lps(str): \r\n\tn = ... |
[
{
"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 find the intersection of two arrays using lambda function.\n\n",
"role": "user"
},
{
"content": "def intersection_array(arra... |
[
{
"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 occcurences of an element in a tuple.\n\n",
"role": "user"
},
{
"content": "def count_X(tup, x): \r\n 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 insert an element before each element of a list.\n\n",
"role": "user"
},
{
"content": "def insert_element(list,element):\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 convert complex numbers to polar coordinates.\n\n",
"role": "user"
},
{
"content": "import cmath \r\ndef convert(num... |
[
{
"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 integers from a given list.\n\n",
"role": "user"
},
{
"content": "def count_integer(list1):\r\n ctr = 0\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 all words starting with 'a' or 'e' in a given string.\n\n",
"role": "user"
},
{
"content": "import re\r\ndef words_ae(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 choose specified number of colours from three different colours and generate all the combinations with repetitions.\n\n",
"role": "u... |
[
{
"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 prime numbers less than a given non-negative number.\n\n",
"role": "user"
},
{
"content": "def 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 swap two numbers.\n\n",
"role": "user"
},
{
"content": "def swap_numbers(a,b):\r\n temp = a\r\n a = b\r\n b = temp\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 find number of odd elements in the given list using lambda function.\n\n",
"role": "user"
},
{
"content": "def count_odd(arr... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to maximize the given two tuples.\n\n",
"role": "user"
},
{
"content": "def maximize_elements(test_tup1, test_tup2):\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 nth newman–shanks–williams prime number.\n\n",
"role": "user"
},
{
"content": "def newman_prime(n): \r\n\tif n == 0... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to perform mathematical division operation across the given tuples.\n\n",
"role": "user"
},
{
"content": "def division_elements... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to split a given list into two parts where the length of the first part of the list is given.\n\n",
"role": "user"
},
{
"conten... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to merge two dictionaries.\n\n",
"role": "user"
},
{
"content": "def merge_dict(d1,d2):\r\n d = d1.copy()\r\n d.update(d2)\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 a dog's age in dog's years.\n\n",
"role": "user"
},
{
"content": "def dog_age(h_age):\r\n if h_age < 0:\r\n \texit... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to split a list for every nth element.\n\n",
"role": "user"
},
{
"content": "def list_split(S, step):\r\n return [S[i::step]... |
[
{
"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 cube.\n\n",
"role": "user"
},
{
"content": "def lateralsurface_cube(l):\r\n LSA = 4 * (l... |
[
{
"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 squares of first n odd natural numbers.\n\n",
"role": "user"
},
{
"content": "def square_Sum(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 find the n'th star number.\n\n",
"role": "user"
},
{
"content": "def find_star_num(n): \r\n\treturn (6 * n * (n - 1) + 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 find the ascii value of a character.\n\n",
"role": "user"
},
{
"content": "def ascii_value(k):\r\n ch=k\r\n return ord(ch)... |
[
{
"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 even numbers at even positions.\n\n",
"role": "user"
},
{
"content": "def sum_even_and_even_index(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 find the sum of fifth power of first n even natural numbers.\n\n",
"role": "user"
},
{
"content": "def even_Power_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 perfom the rear element extraction from list of tuples records.\n\n",
"role": "user"
},
{
"content": "def rear_extract(test_... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to substract the contents of one tuple with corresponding index of other tuple.\n\n",
"role": "user"
},
{
"content": "def subst... |
[
{
"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 even index binomial coefficients.\n\n",
"role": "user"
},
{
"content": "import math \r\ndef even_binomia... |
[
{
"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 position of the last removed element from the given array.\n\n",
"role": "user"
},
{
"content": "import math... |
[
{
"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 volume of a cylinder.\n\n",
"role": "user"
},
{
"content": "def volume_cylinder(r,h):\r\n volume=3.1415*r*r*h\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 filter a dictionary based on values.\n\n",
"role": "user"
},
{
"content": "def dict_filter(dict,n):\r\n result = {key:value ... |
[
{
"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 element count that occurs before the record in the given tuple.\n\n",
"role": "user"
},
{
"content": "def count_fir... |
[
{
"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 decagonal number.\n\n",
"role": "user"
},
{
"content": "def is_num_decagonal(n): \r\n\treturn 4 * n * n - 3 * 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 search an element in the given array by using sequential search.\n\n",
"role": "user"
},
{
"content": "def sequential_search... |
[
{
"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 if the elements of a given list are unique or not.\n\n",
"role": "user"
},
{
"content": "def all_unique(test_li... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to substaract two lists using map and lambda function.\n\n",
"role": "user"
},
{
"content": "def sub_list(nums1,nums2):\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 python function to check whether the frequency of each digit is less than or equal to the digit itself.\n\n",
"role": "user"
},
{
"conte... |
[
{
"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 all items of a list are equal to a given string.\n\n",
"role": "user"
},
{
"content": "def check_element(list,... |
[
{
"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 two to three 'b'.\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 find the largest sum of contiguous array in the modified array which is formed by repeating the given array k times.\n\n",
"role": "... |
[
{
"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 squares of first n even natural numbers.\n\n",
"role": "user"
},
{
"content": "def square_Sum(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 count array elements having modular inverse under given prime number p equal to itself.\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 python function to calculate the number of odd days in a given year.\n\n",
"role": "user"
},
{
"content": "def odd_Days(N): \r\n hund... |
[
{
"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 list of lists with maximum length.\n\n",
"role": "user"
},
{
"content": "def max_length(list1):\r\n max_length =... |
[
{
"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 out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n post... |
[
{
"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 quotient of two numbers.\n\n",
"role": "user"
},
{
"content": "def find(n,m): \r\n q = n//m \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 function to find the third side of a right angled triangle.\n\n",
"role": "user"
},
{
"content": "import math\r\ndef otherside_rightangl... |
[
{
"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 maximum value in a given heterogeneous list.\n\n",
"role": "user"
},
{
"content": "def max_val(listval):\r\n 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 return the sum of all divisors of a number.\n\n",
"role": "user"
},
{
"content": "def sum_div(number):\r\n divisors = [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 count inversions in an array.\n\n",
"role": "user"
},
{
"content": "def get_Inv_Count(arr,n): \r\n inv_count = 0\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 flatten a given nested list structure.\n\n",
"role": "user"
},
{
"content": "def flatten_list(list1):\r\n result_list = [... |
[
{
"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 nested list elements which are present in another list.\n\n",
"role": "user"
},
{
"content": "def intersection_nest... |
[
{
"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 maximum aggregate from the list of tuples.\n\n",
"role": "user"
},
{
"content": "from collections import defau... |
[
{
"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 count of all binary sequences of length 2n such that sum of first n bits is same as sum of last n bits.\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 find the depth of a dictionary.\n\n",
"role": "user"
},
{
"content": "def dict_depth(d):\r\n if isinstance(d, dict):\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 find the most significant bit number which is also a set bit.\n\n",
"role": "user"
},
{
"content": "def set_Bit_Numbe... |
[
{
"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 inversion of two types are same or not.\n\n",
"role": "user"
},
{
"content": "import sys \... |
[
{
"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 element at a given index after number of rotations.\n\n",
"role": "user"
},
{
"content": "def find_Element(arr,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 match two words from a list of words starting with letter 'p'.\n\n",
"role": "user"
},
{
"content": "import re\r\ndef start_... |
[
{
"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 maximum sum of increasing subsequence from prefix till ith index and also including a given kth element which is after i, i.e.,... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to get a colon of a tuple.\n\n",
"role": "user"
},
{
"content": "from copy import deepcopy\r\ndef colon_tuplex(tuplex,m,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 to find the specified number of largest products from two given lists.\n\n",
"role": "user"
},
{
"content": "def large_product(... |
[
{
"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 maximum of two numbers.\n\n",
"role": "user"
},
{
"content": "def maximum(a,b): \r\n if a >= b: \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 convert a given string to a tuple.\n\n",
"role": "user"
},
{
"content": "def string_to_tuple(str1):\r\n result = tuple(x ... |
[
{
"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 set the left most unset bit.\n\n",
"role": "user"
},
{
"content": "def set_left_most_unset_bit(n): \r\n if not (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 volume of a cone.\n\n",
"role": "user"
},
{
"content": "import math\r\ndef volume_cone(r,h):\r\n volume = (1.0/3) ... |
[
{
"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 print positive numbers in a list.\n\n",
"role": "user"
},
{
"content": "def pos_nos(list1):\r\n for num in list1: \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 find out the maximum sum such that no two chosen numbers are adjacent for the given rectangular grid of dimension 2 x n.\n\n",
"role... |
[
{
"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 first maximum length of even word.\n\n",
"role": "user"
},
{
"content": "def find_Max_Len_Even(str): \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 index of the last occurrence of a given number in a sorted array.\n\n",
"role": "user"
},
{
"content": "def find_la... |
[
{
"content": "\nWrite a functional code based on the question given in the QUESTION field.\n",
"role": "system"
},
{
"content": "\nQUESTION:\n\nWrite a function to reflect the modified run-length encoding from a list.\n\n",
"role": "user"
},
{
"content": "from itertools import groupby\r\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.