Search is not available for this dataset
messages
listlengths
3
3
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n \"\"\" Check if in given list ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef separate_paren_groups(paren_string: str) -> List[str]:\n \"\"\" Input to this function is a string c...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef truncate_number(number: float) -> float:\n \"\"\" Given a positive floating point number, it can be decomposed into\n and ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef below_zero(operations: List[int]) -> bool:\n \"\"\" You're given a list of deposit and withdrawal op...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef mean_absolute_deviation(numbers: List[float]) -> float:\n \"\"\" For a given list of input numbers, ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef intersperse(numbers: List[int], delimeter: int) -> List[int]:\n \"\"\" Insert a number 'delimeter' b...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef parse_nested_parens(paren_string: str) -> List[int]:\n \"\"\" Input to this function is a string rep...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef filter_by_substring(strings: List[str], substring: str) -> List[str]:\n \"\"\" Filter an input list ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List, Tuple\n\n\ndef sum_product(numbers: List[int]) -> Tuple[int, int]:\n \"\"\" For a given list of integers, re...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List, Tuple\n\n\ndef rolling_max(numbers: List[int]) -> List[int]:\n \"\"\" From a given list of integers, generat...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef is_palindrome(string: str) -> bool:\n \"\"\" Test if given string is a palindrome \"\"\"\n return string == string[::-1]\n...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef string_xor(a: str, b: str) -> str:\n \"\"\" Input are two strings a and b consisting only of 1s and ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List, Optional\n\n\ndef longest(strings: List[str]) -> Optional[str]:\n \"\"\" Out of list of strings, return the ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef greatest_common_divisor(a: int, b: int) -> int:\n \"\"\" Return a greatest common divisor of two integers a and b\n >>> gr...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef all_prefixes(string: str) -> List[str]:\n \"\"\" Return list of all prefixes from shortest to longes...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef string_sequence(n: int) -> str:\n \"\"\" Return a string containing space-delimited numbers starting from 0 upto n inclusive....
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef count_distinct_characters(string: str) -> int:\n \"\"\" Given a string, find out how many distinct characters (regardless of ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef parse_music(music_string: str) -> List[int]:\n \"\"\" Input to this function is a string representin...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef how_many_times(string: str, substring: str) -> int:\n \"\"\" Find how many times a given substring can be found in the origin...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef sort_numbers(numbers: str) -> str:\n \"\"\" Input is a space-delimited string of numberals from 'zer...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List, Tuple\n\n\ndef find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n \"\"\" From a supplied ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef rescale_to_unit(numbers: List[float]) -> List[float]:\n \"\"\" Given list of numbers (of at least tw...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List, Any\n\n\ndef filter_integers(values: List[Any]) -> List[int]:\n \"\"\" Filter given list of any python value...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef strlen(string: str) -> int:\n \"\"\" Return length of given string\n >>> strlen('')\n 0\n >>> strlen('abc')\n 3\n...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef largest_divisor(n: int) -> int:\n \"\"\" For a given number n, find the largest number that divides n evenly, smaller than n\...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef factorize(n: int) -> List[int]:\n \"\"\" Return list of prime factors of given integer in the order ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef remove_duplicates(numbers: List[int]) -> List[int]:\n \"\"\" From a list of integers, remove all ele...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef flip_case(string: str) -> str:\n \"\"\" For a given string, flip lowercase characters to uppercase and uppercase to lowercase...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef concatenate(strings: List[str]) -> str:\n \"\"\" Concatenate list of strings into a single string\n ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nfrom typing import List\n\n\ndef filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n \"\"\" Filter an input list of str...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef get_positive(l: list):\n \"\"\"Return only positive numbers in the list.\n >>> get_positive([-1, 2, -4, 5, 6])\n [2, 5,...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef is_prime(n):\n \"\"\"Return true if a given number is prime, and false otherwise.\n >>> is_prime(6)\n False\n >>> is...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\nimport math\n\n\ndef poly(xs: list, x: float):\n \"\"\"\n Evaluates polynomial with coefficients xs at point x.\n return xs[0] ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef sort_third(l: list):\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the in...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef unique(l: list):\n \"\"\"Return sorted unique elements in a list\n >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])\n [0, 2, 3...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef max_element(l: list):\n \"\"\"Return maximum element in the list.\n >>> max_element([1, 2, 3])\n 3\n >>> max_element...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef fizz_buzz(n: int):\n \"\"\"Return the number of times the digit 7 appears in integers less than n which are divisible by 11 o...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef sort_even(l: list):\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the odd...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef encode_cyclic(s: str):\n \"\"\"\n returns encoded string by cycling groups of three characters.\n \"\"\"\n # split s...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef prime_fib(n: int):\n \"\"\"\n prime_fib returns n-th number that is a Fibonacci number and it's also prime.\n >>> prime...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef triples_sum_to_zero(l: list):\n \"\"\"\n triples_sum_to_zero takes a list of integers as an input.\n it returns True if...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef car_race_collision(n: int):\n \"\"\"\n Imagine a road that's a perfectly straight infinitely long line.\n n cars are dr...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef incr_list(l: list):\n \"\"\"Return list with elements incremented by 1.\n >>> incr_list([1, 2, 3])\n [2, 3, 4]\n >>>...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef pairs_sum_to_zero(l):\n \"\"\"\n pairs_sum_to_zero takes a list of integers as an input.\n it returns True if there are...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef change_base(x: int, base: int):\n \"\"\"Change numerical base of input number x to base.\n return string representation af...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef triangle_area(a, h):\n \"\"\"Given length of a side and high return area for a triangle.\n >>> triangle_area(5, 3)\n 7....
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef fib4(n: int):\n \"\"\"The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\n ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef median(l: list):\n \"\"\"Return median of elements in the list l.\n >>> median([3, 1, 2, 4, 5])\n 3\n >>> median([-1...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef is_palindrome(text: str):\n \"\"\"\n Checks if given string is a palindrome\n >>> is_palindrome('')\n True\n >>> ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef modp(n: int, p: int):\n \"\"\"Return 2^n modulo p (be aware of numerics).\n >>> modp(3, 5)\n 3\n >>> modp(1101, 101)...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef encode_shift(s: str):\n \"\"\"\n returns encoded string by shifting every character by 5 in the alphabet.\n \"\"\"\n ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef remove_vowels(text):\n \"\"\"\n remove_vowels is a function that takes string and returns string without vowels.\n >>> ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef below_threshold(l: list, t: int):\n \"\"\"Return True if all numbers in the list l are below threshold t.\n >>> below_thre...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef add(x: int, y: int):\n \"\"\"Add two numbers x and y\n >>> add(2, 3)\n 5\n >>> add(5, 7)\n 12\n \"\"\"\n\n", ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef same_chars(s0: str, s1: str):\n \"\"\"\n Check if two words have the same characters.\n >>> same_chars('eabcdzzzz', 'dd...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef fib(n: int):\n \"\"\"Return n-th Fibonacci number.\n >>> fib(10)\n 55\n >>> fib(1)\n 1\n >>> fib(8)\n 21\n ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef correct_bracketing(brackets: str):\n \"\"\" brackets is a string of \"<\" and \">\".\n return True if every opening bracke...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef monotonic(l: list):\n \"\"\"Return True is list elements are monotonically increasing or decreasing.\n >>> monotonic([1, 2...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef common(l1: list, l2: list):\n \"\"\"Return sorted unique common elements for two lists.\n >>> common([1, 4, 3, 34, 653, 2,...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef largest_prime_factor(n: int):\n \"\"\"Return the largest prime factor of n. Assume n > 1 and is not a prime.\n >>> largest...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef sum_to_n(n: int):\n \"\"\"sum_to_n is a function that sums numbers from 1 to n.\n >>> sum_to_n(30)\n 465\n >>> sum_t...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef correct_bracketing(brackets: str):\n \"\"\" brackets is a string of \"(\" and \")\".\n return True if every opening bracke...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef derivative(xs: list):\n \"\"\" xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n R...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef fibfib(n: int):\n \"\"\"The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\nFIX = \"\"\"\nAdd more test cases.\n\"\"\"\n\ndef vowels_count(s):\n \"\"\"Write a function vowels_count which takes a string repre...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef circular_shift(x, shift):\n \"\"\"Circular shift the digits of the integer x, shift the digits right by shift\n and return t...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef digitSum(s):\n \"\"\"Task\n Write a function that takes a string as input and returns the sum of the upper characters only'\...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef fruit_distribution(s,n):\n \"\"\"\n In this task, you will be given a string that represents a number of apples and oranges ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef pluck(arr):\n \"\"\"\n \"Given an array representing a branch of a tree that has non-negative integer nodes\n your task i...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef search(lst):\n '''\n You are given a non-empty list of positive integers. Return the greatest integer that is greater than \...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef strange_sort_list(lst):\n '''\n Given list of integers, return list in strange order.\n Strange sorting, is when you star...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef triangle_area(a, b, c):\n '''\n Given the lengths of the three sides of a triangle. Return the area of\n the triangle rou...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef will_it_fly(q,w):\n '''\n Write a function that returns True if the object q will fly, and False otherwise.\n The object ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef smallest_change(arr):\n \"\"\"\n Given an array arr of integers, find the minimum number of elements that\n need to be ch...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef total_match(lst1, lst2):\n '''\n Write a function that accepts two lists of strings and returns the list that has \n tota...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef is_multiply_prime(a):\n \"\"\"Write a function that returns true if the given number is the multiplication of 3 prime numbers\n...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef is_simple_power(x, n):\n \"\"\"Your task is to write a function that returns true if a number x is a simple\n power of n and...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef iscube(a):\n '''\n Write a function that takes an integer a and returns True \n if this ingeger is a cube of some integer...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef hex_key(num):\n \"\"\"You have been tasked to write a function that receives \n a hexadecimal number as a string and counts ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef decimal_to_binary(decimal):\n \"\"\"You will be given a number in decimal form and your task is to convert it to\n binary fo...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef is_happy(s):\n \"\"\"You are given a string s.\n Your task is to check if the string is happy or not.\n A string is happy...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef numerical_letter_grade(grades):\n \"\"\"It is the last week of the semester and the teacher has to give the grades\n to stud...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef prime_length(string):\n \"\"\"Write a function that takes a string and returns True if the string\n length is a prime number...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef starts_one_ends(n):\n \"\"\"\n Given a positive integer n, return the count of the numbers of n-digit\n positive integers...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef solve(N):\n \"\"\"Given a positive integer N, return the total sum of its digits in binary.\n \n Example\n For N =...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef add(lst):\n \"\"\"Given a non-empty list of integers lst. add the even elements that are at odd indices..\n\n\n Examples:\n ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef anti_shuffle(s):\n \"\"\"\n Write a function that takes a string and returns an ordered version of it.\n Ordered version ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef get_row(lst, x):\n \"\"\"\n You are given a 2 dimensional data, as a nested lists,\n which is similar to matrix, however,...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef sort_array(array):\n \"\"\"\n Given an array of non-negative integers, return a copy of the given array after sorting,\n ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef encrypt(s):\n \"\"\"Create a function encrypt that takes a string as an argument and\n returns a string encrypted with the a...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef next_smallest(lst):\n \"\"\"\n You are given a list of integers.\n Write a function next_smallest() that returns the 2nd ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef is_bored(S):\n \"\"\"\n You'll be given a string of words, and your task is to count the number\n of boredoms. A boredom ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef any_int(x, y, z):\n '''\n Create a function that takes 3 numbers.\n Returns true if one of the numbers is equal to the su...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef encode(message):\n \"\"\"\n Write a function that takes a message, and encodes in such a \n way that it swaps case of all...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\n\ndef skjkasdkd(lst):\n \"\"\"You are given a list of integers.\n You need to find the largest prime value and return the sum of...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef check_dict_case(dict):\n \"\"\"\n Given a dictionary, return True if all keys are strings in lower \n case or all keys ar...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef count_up_to(n):\n \"\"\"Implement a function that takes an non-negative integer and returns an array of the first n\n intege...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef multiply(a, b):\n \"\"\"Complete the function that takes two integers and returns \n the product of their unit digits.\n ...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef count_upper(s):\n \"\"\"\n Given a string s, count the number of uppercase vowels in even indices.\n \n For example:\n...
[ { "content": "\nComplete the given code snippet under the CODE field based on its function signature and examples.\n", "role": "system" }, { "content": "\nCODE:\n\n\ndef closest_integer(value):\n '''\n Create a function that takes a value (string) representing a number\n and returns the clo...