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 python function to find the last digit when factorial of a divides factorial of b.\n\n", "role": "user" }, { "content": "def compute_Las...
[ { "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 all odd bits of a given number.\n\n", "role": "user" }, { "content": "def odd_bit_set_number(n):\r\n count = 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 extract every first or specified element from a given two-dimensional list.\n\n", "role": "user" }, { "content": "def specif...
[ { "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 with minimum length using lambda function.\n\n", "role": "user" }, { "content": "def min_length_list(input_lis...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to print check if the triangle is equilateral or not.\n\n", "role": "user" }, { "content": "def check_equilateral(x,y,z):\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 caluclate area of a parallelogram.\n\n", "role": "user" }, { "content": "def parallelogram_area(b,h):\r\n area=b*h\r\n ret...
[ { "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 first and last characters of a given string are equal or not.\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 the given array by using counting sort.\n\n", "role": "user" }, { "content": "def counting_sort(my_list):\r\n max_va...
[ { "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 t-nth term of geometric series.\n\n", "role": "user" }, { "content": "import math\r\ndef tn_gp(a,n,r):\r\n tn = a * (m...
[ { "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 a given number is one less than twice its reverse.\n\n", "role": "user" }, { "content": "def rev(num): \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 largest number that can be formed with the given digits.\n\n", "role": "user" }, { "content": "def find_Max_...
[ { "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 given two integers have opposite sign or not.\n\n", "role": "user" }, { "content": "def opposite_Si...
[ { "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 octagonal number.\n\n", "role": "user" }, { "content": "def is_octagonal(n): \r\n\treturn 3 * n * n - 2 * 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 maximum length of the subsequence with difference between adjacent elements for the given array.\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 python function to count number of substrings with the sum of digits equal to their length.\n\n", "role": "user" }, { "content": "from 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 smallest number in a list.\n\n", "role": "user" }, { "content": "def smallest_num(xs):\n return min(xs)\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 maximum difference between available pairs in the given tuple list.\n\n", "role": "user" }, { "content": "def max_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 sort a list of tuples using lambda.\n\n", "role": "user" }, { "content": "def subject_marks(subjectmarks):\r\n#subject_marks...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function of recursion list sum.\n\n", "role": "user" }, { "content": "def recursive_list_sum(data_list):\r\n\ttotal = 0\r\n\tfor element...
[ { "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 positive numbers in a list.\n\n", "role": "user" }, { "content": "def pos_count(list):\r\n pos_count= 0\r\n 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 find the number of ways to partition a set of bell numbers.\n\n", "role": "user" }, { "content": "def bell_number(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 python function to check whether the given array is monotonic or not.\n\n", "role": "user" }, { "content": "def is_Monotonic(A): \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 check whether a list contains the given sublist or not.\n\n", "role": "user" }, { "content": "def is_sublist(l, s):\r\n\tsub...
[ { "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 all the given tuples have equal length or not.\n\n", "role": "user" }, { "content": "def find_equal_tuple(Input...
[ { "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 elements using comb sort.\n\n", "role": "user" }, { "content": "def comb_sort(nums):\r\n shrink_fact = 1.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 check whether the given number can be represented as difference of two squares or not.\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 split the given string with multiple delimiters by using regex.\n\n", "role": "user" }, { "content": "import re\r\ndef multi...
[ { "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 it follows the sequence given in the patterns array.\n\n", "role": "user" }, { "content": "def is_samepatterns...
[ { "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 tuples which have all elements divisible by k from the given list of tuples.\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 python function to count the number of squares in a rectangle.\n\n", "role": "user" }, { "content": "def count_Squares(m,n):\r\n if(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 difference between sum of even and odd digits.\n\n", "role": "user" }, { "content": "def is_Diff(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 python function to find number of integers with odd number of set bits.\n\n", "role": "user" }, { "content": "def count_With_Odd_SetBits...
[ { "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 length of the word is odd or not.\n\n", "role": "user" }, { "content": "def word_len(s): \r\n 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 find the nth tetrahedral number.\n\n", "role": "user" }, { "content": "def tetrahedral_number(n): \r\n\treturn (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 function to zip the two given tuples.\n\n", "role": "user" }, { "content": "def zip_tuples(test_tup1, test_tup2):\r\n res = []\r\n for...
[ { "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 sphere.\n\n", "role": "user" }, { "content": "import math\r\ndef volume_sphere(r):\r\n volume=(4/3)*ma...
[ { "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 character made by adding all the characters of the given string.\n\n", "role": "user" }, { "content": "def g...
[ { "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 number in newman conway sequence.\n\n", "role": "user" }, { "content": "def sequence(n): \r\n\tif n == 1 or 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 surface area of a sphere.\n\n", "role": "user" }, { "content": "import math\r\ndef surfacearea_sphere(r):\r\n surf...
[ { "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 centered hexagonal number.\n\n", "role": "user" }, { "content": "def centered_hexagonal_number(n):\r\n return 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 merge three dictionaries into a single expression.\n\n", "role": "user" }, { "content": "import collections as ct\r\ndef mer...
[ { "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 the frequency of the elements in a list.\n\n", "role": "user" }, { "content": "import collections\r\ndef freq_count(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 closest smaller number than n.\n\n", "role": "user" }, { "content": "def closest_num(N):\r\n return (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 find the length of the longest word.\n\n", "role": "user" }, { "content": "def len_log(list1):\r\n max=len(list1[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 check if a substring is present in a given list of string values.\n\n", "role": "user" }, { "content": "def find_substring(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 check whether the given number is undulating or not.\n\n", "role": "user" }, { "content": "def is_undulating(n): \r\n\tif (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 calculate the value of 'a' to the power 'b'.\n\n", "role": "user" }, { "content": "def power(a,b):\r\n\tif b==0:\r\n\t\tretu...
[ { "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 the index minimum value record from the given tuples.\n\n", "role": "user" }, { "content": "from operator import ite...
[ { "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 length of sublist.\n\n", "role": "user" }, { "content": "def Find_Min_Length(lst): \r\n minLengt...
[ { "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 number of divisors of a given integer.\n\n", "role": "user" }, { "content": "def divisor(n):\r\n for i in 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 frequency count of list of lists.\n\n", "role": "user" }, { "content": "def frequency_lists(list1):\r\n list1 = [ite...
[ { "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 all the numbers in a list and divide with the length of the list.\n\n", "role": "user" }, { "content": "def multipl...
[ { "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 decimal number to its binary equivalent.\n\n", "role": "user" }, { "content": "def decimal_to_binary(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 next smallest palindrome of a specified number.\n\n", "role": "user" }, { "content": "import sys\r\ndef next_smalle...
[ { "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 kth element in the given array.\n\n", "role": "user" }, { "content": "def kth_element(arr, n, k):\r\n for i in ran...
[ { "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 snake case string to camel case string.\n\n", "role": "user" }, { "content": "def snake_to_camel(word):\r\n 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 find eulerian number a(n, m).\n\n", "role": "user" }, { "content": "def eulerian_num(n, m): \r\n\tif (m >= n or n == 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 sort each sublist of strings in a given list of lists using lambda function.\n\n", "role": "user" }, { "content": "def sort_...
[ { "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 true booleans in the given list.\n\n", "role": "user" }, { "content": "def count(lst): \r\n return sum(lst...
[ { "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 list to the given tuples.\n\n", "role": "user" }, { "content": "def add_lists(test_list, 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 hexadecimal numbers for a given range.\n\n", "role": "user" }, { "content": "def count_Hexadecimal(L,R) : \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 merge multiple sorted inputs into a single sorted iterator using heap queue algorithm.\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 find the count of rotations of a binary string with odd value.\n\n", "role": "user" }, { "content": "def odd_Equivale...
[ { "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 the ranges that are missing from the given list with the given start range and end range values.\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 common elements in given nested lists. * list item * list item * list item * list item\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 python function to find the perimeter of a cylinder.\n\n", "role": "user" }, { "content": "def perimeter(diameter,height) : \r\n retu...
[ { "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 a string represents an integer or not.\n\n", "role": "user" }, { "content": "def check_integer(text):\r\n text = te...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to assign frequency to each tuple in the given tuple list.\n\n", "role": "user" }, { "content": "from collections import Counte...
[ { "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 dictionaries in a list are empty or not.\n\n", "role": "user" }, { "content": "def empty_dit(list1):\r\n 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 convert a given tuple of positive integers into an integer.\n\n", "role": "user" }, { "content": "def tuple_to_int(nums):\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 convert all possible convertible elements in the list to float.\n\n", "role": "user" }, { "content": "def list_to_float(test...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\n[link text](https:// [link text](https:// [link text](https://)))write a function to convert a string to a list.\n\n", "role": "user" }, { "cont...
[ { "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 element that appears only once in a sorted array.\n\n", "role": "user" }, { "content": "def search(arr,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 maximum product from the pairs of tuples within a given list.\n\n", "role": "user" }, { "content": "def max_product...
[ { "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 triplet with sum of the given array\n\n", "role": "user" }, { "content": "def check_triplet(A, n, sum, count):\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 n’th smart number.\n\n", "role": "user" }, { "content": "MAX = 3000 \r\ndef smartNumber(n): \r\n\tprimes = [0] * MAX \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 sum all amicable numbers from 1 to a specified number.\n\n", "role": "user" }, { "content": "def amicable_numbers_sum(limit)...
[ { "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 the angle of a complex number.\n\n", "role": "user" }, { "content": "import cmath\r\ndef angle_complex(a,b):\r\n cn=com...
[ { "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 difference between the number of 0s and number of 1s in any sub-string of the given binary string.\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 find the sum of common divisors of two given numbers.\n\n", "role": "user" }, { "content": "def sum(a,b): \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 multiply two integers without using the * operator in python.\n\n", "role": "user" }, { "content": "def multiply_int(x, y):\...
[ { "content": "\nWrite a functional code based on the question given in the QUESTION field.\n", "role": "system" }, { "content": "\nQUESTION:\n\nWrite a function to shortlist words that are longer than n from a given list of words.\n\n", "role": "user" }, { "content": "def long_words(n, 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 calculate magic square.\n\n", "role": "user" }, { "content": "def magic_square_test(my_matrix):\r\n iSize = len(my_matrix...
[ { "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 item with maximum frequency in a given list.\n\n", "role": "user" }, { "content": "from collections import defaultd...
[ { "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 reverse only the vowels of a given string.\n\n", "role": "user" }, { "content": "def reverse_vowels(str1):\r\n\tvowel...
[ { "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 to a string.\n\n", "role": "user" }, { "content": "def tup_string(tup1):\r\n str = ''.join(tup1)\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 calculate the sum of the negative numbers of a given list of numbers using lambda function.\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 python function to check whether the last element of given array is even or odd after performing an operation p times.\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 nth hexagonal number.\n\n", "role": "user" }, { "content": "def hexagonal_num(n): \r\n\treturn n*(2*n - 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 calculate electricity bill.\n\n", "role": "user" }, { "content": "def cal_electbill(units):\r\n if(units < 50):\r\n amoun...
[ { "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 ration of zeroes in an array of integers.\n\n", "role": "user" }, { "content": "from array import array\r\ndef zero...
[ { "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 given number can be represented as sum of non-zero powers of 2 or not.\n\n", "role": "user" }, { "c...
[ { "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 circumference of a circle.\n\n", "role": "user" }, { "content": "def circle_circumference(r):\r\n perimeter=2*3.14...
[ { "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 elements that occur singly in the given tuple list.\n\n", "role": "user" }, { "content": "def extract_singly(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 sort a list of elements using pancake sort.\n\n", "role": "user" }, { "content": "def pancake_sort(nums):\r\n arr_len = 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 count the same pair in three given lists.\n\n", "role": "user" }, { "content": "def count_samepair(list1,list2,list3):\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 number of lists present in the given tuple.\n\n", "role": "user" }, { "content": "def find_lists(Input): \r\n\tif isins...
[ { "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 absolute differences in all pairs of the given array.\n\n", "role": "user" }, { "content": "def sum_P...
[ { "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 difference between any two elements in a given array.\n\n", "role": "user" }, { "content": "def max_...
[ { "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 total characters in a string.\n\n", "role": "user" }, { "content": "def ascii_value_string(str1):\r\...