Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      Failed to parse string: 'other' as a scalar of type double
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1837, in _prepare_split_single
                  writer.write_table(table)
                  ~~~~~~~~~~~~~~~~~~^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 765, in write_table
                  self._write_table(pa_table, writer_batch_size=writer_batch_size)
                  ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 773, in _write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2369, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2303, in cast_table_to_schema
                  cast_array_to_feature(
                  ~~~~~~~~~~~~~~~~~~~~~^
                      table[name] if name in table_column_names else pa.array([None] * len(table), type=schema.field(name).type),
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      feature,
                      ^^^^^^^^
                  )
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 1852, in wrapper
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                                           ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2143, in cast_array_to_feature
                  return array_cast(
                      array,
                  ...<2 lines>...
                      allow_decimal_to_str=allow_decimal_to_str,
                  )
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 1854, in wrapper
                  return func(array, *args, **kwargs)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2006, in array_cast
                  return array.cast(pa_type)
                         ~~~~~~~~~~^^^^^^^^^
                File "pyarrow/array.pxi", line 1147, in pyarrow.lib.Array.cast
                File "/usr/local/lib/python3.14/site-packages/pyarrow/compute.py", line 412, in cast
                  return call_function("cast", [arr], options, memory_pool)
                File "pyarrow/_compute.pyx", line 604, in pyarrow._compute.call_function
                File "pyarrow/_compute.pyx", line 399, in pyarrow._compute.Function.call
                  result = GetResultValue(
                File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
                  raise convert_status(status)
              pyarrow.lib.ArrowInvalid: Failed to parse string: 'other' as a scalar of type double
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1683, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1869, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

id
string
category
null
correct
bool
expected
string
predicted
string
question
string
raw_response
string
time_s
float64
HumanEval/0
null
true
(unit tests)
from typing import List def has_close_elements(numbers: List[float], threshold: float) -> bool: """ Check if in given list of numbers, are any two numbers closer to each other than given thr...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def has_close_elements(numbers: List[float], threshold: float) -> bool: """ Check if in given list of numbers, are any two numbers closer to each other than given threshold. ...
The user wants a Python function `has_close_elements` that checks if any two numbers in a list are closer to each other than a given `threshold`. The function signature is: `def has_close_elements(numbers: List[float], threshold: float) -> bool:` Approach: 1. Sort the list of numbers. 2. Iterate through the sorted lis...
35.23
HumanEval/1
null
true
(unit tests)
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: result = [] current_group = [] depth = 0 for char in paren_string: if char == ' ': ...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate thos...
The user wants a Python function that takes a string of parentheses and separates them into distinct, balanced groups. Spaces should be ignored. The groups are not nested within each other, meaning we just need to split the string whenever a balanced group is completed. Let's trace the example: Input: `'( ) (( )) (( )...
44.935
HumanEval/2
null
true
(unit tests)
def truncate_number(number: float) -> float: return number - int(number)
Complete the following Python function. Provide only the complete function implementation, no explanations. def truncate_number(number: float) -> float: """ Given a positive floating point number, it can be decomposed into and integer part (largest integer smaller than given number) and decimals (leftove...
The user wants a Python function that takes a positive floating-point number and returns its decimal part. The integer part is the largest integer smaller than the number. The decimal part is the leftover part, always smaller than 1. For example, `truncate_number(3.5)` should return `0.5`. Mathematically, the decimal ...
14.839
HumanEval/3
null
true
(unit tests)
from typing import List def below_zero(operations: List[int]) -> bool: balance = 0 for op in operations: balance += op if balance < 0: return True return False
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to dete...
The user wants a Python function `below_zero` that takes a list of integers representing deposits and withdrawals. The account starts with a balance of 0. The function should return `True` if at any point the balance falls below zero, and `False` otherwise. Let's trace the examples: `below_zero([1, 2, 3])` -> balance ...
14.262
HumanEval/4
null
true
(unit tests)
from typing import List def mean_absolute_deviation(numbers: List[float]) -> float: mean_val = sum(numbers) / len(numbers) return sum(abs(x - mean_val) for x in numbers) / len(numbers)
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def mean_absolute_deviation(numbers: List[float]) -> float: """ For a given list of input numbers, calculate Mean Absolute Deviation around the mean of this dataset. Mean Ab...
The user wants a Python function that calculates the Mean Absolute Deviation (MAD) of a list of numbers. The formula is: MAD = (1/n) * sum(|x_i - mean|) where mean = (1/n) * sum(x_i) Let's write the code: 1. Calculate the mean of the list. 2. Calculate the absolute difference of each element from the mean. 3. Calculat...
11.329
HumanEval/5
null
true
(unit tests)
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: result = [] for i, num in enumerate(numbers): result.append(num) if i < len(numbers) ...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse(...
The user wants a Python function `intersperse` that takes a list of integers `numbers` and an integer `delimeter`. It should insert the `delimeter` between every two consecutive elements of `numbers`. If the list is empty, it should return an empty list. If the list has one element, it should return the list as is (sin...
24.708
HumanEval/6
null
true
(unit tests)
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: result = [] for group in paren_string.split(): current_depth = 0 max_depth = 0 for cha...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each ...
The user wants a Python function that takes a string of space-separated groups of parentheses and returns a list of integers representing the maximum nesting depth for each group. Let's break down the problem: Input: A string like `'(()()) ((())) () ((())()())'` Output: A list of integers like `[2, 3, 1, 3]` Each gro...
32.988
HumanEval/7
null
true
(unit tests)
from typing import List def filter_by_substring(strings: List[str], substring: str) -> List[str]: """ Filter an input list of strings only for ones that contain given substring >>> filter_by_...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def filter_by_substring(strings: List[str], substring: str) -> List[str]: """ Filter an input list of strings only for ones that contain given substring >>> filter_by_substring(...
The user wants a Python function that filters a list of strings, keeping only those that contain a specific substring. The function signature is: `def filter_by_substring(strings: List[str], substring: str) -> List[str]:` I need to return a list of strings from `strings` that contain `substring`. This can be done usin...
16.234
HumanEval/8
null
true
(unit tests)
from typing import List, Tuple def sum_product(numbers: List[int]) -> Tuple[int, int]: total_sum = sum(numbers) total_product = 1 for num in numbers: total_product *= num retu...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List, Tuple def sum_product(numbers: List[int]) -> Tuple[int, int]: """ For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. ...
The user wants a Python function that calculates the sum and product of a list of integers. The function should return a tuple `(sum, product)`. If the list is empty, the sum should be 0 and the product should be 1. I need to provide only the complete function implementation. Let's write the function: ```python def su...
20.317
HumanEval/9
null
true
(unit tests)
from typing import List, Tuple def rolling_max(numbers: List[int]) -> List[int]: if not numbers: return [] result = [] current_max = numbers[0] for num in numbers: if ...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List, Tuple def rolling_max(numbers: List[int]) -> List[int]: """ From a given list of integers, generate a list of rolling maximum element found until given moment in the sequence. ...
The user wants a Python function `rolling_max` that takes a list of integers and returns a list of integers where each element is the maximum value encountered so far in the input list up to that index. Input: `numbers: List[int]` Output: `List[int]` Example: Input: `[1, 2, 3, 2, 3, 4, 2]` Output: `[1, 2, 3, 3, 3, 4,...
26.241
HumanEval/10
null
true
(unit tests)
def make_palindrome(string: str) -> str: for i in range(len(string) + 1): if string[i:] == string[i:][::-1]: return string + string[:i][::-1]
Complete the following Python function. Provide only the complete function implementation, no explanations. def is_palindrome(string: str) -> bool: """ Test if given string is a palindrome """ return string == string[::-1] def make_palindrome(string: str) -> str: """ Find the shortest palindrome that b...
The user wants a Python function `make_palindrome(string: str) -> str` that finds the shortest palindrome starting with the given string. The algorithm is described: 1. Find the longest postfix of the string that is a palindrome. 2. Append the reverse of the prefix before that palindromic suffix to the end of the strin...
37.047
HumanEval/11
null
true
(unit tests)
from typing import List def string_xor(a: str, b: str) -> str: return ''.join('1' if x != y else '0' for x, y in zip(a, b))
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def string_xor(a: str, b: str) -> str: """ Input are two strings a and b consisting only of 1s and 0s. Perform binary XOR on these inputs and return result also as a string. ...
The user wants a Python function that performs binary XOR on two binary strings `a` and `b`. The input strings consist only of '1's and '0's. The output should be a string representing the binary XOR result. The lengths of `a` and `b` are assumed to be equal based on typical XOR problems, but I should handle cases wher...
19.279
HumanEval/12
null
true
(unit tests)
from typing import List, Optional def longest(strings: List[str]) -> Optional[str]: """ Out of list of strings, return the longest one. Return the first one in case of multiple strings of the...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List, Optional def longest(strings: List[str]) -> Optional[str]: """ Out of list of strings, return the longest one. Return the first one in case of multiple strings of the same leng...
The user wants a Python function `longest` that takes a list of strings and returns the longest one. If there are multiple strings with the same maximum length, return the first one. If the input list is empty, return `None`. Let's write out the logic: 1. Check if the list is empty. If so, return `None`. 2. Initialize...
18.825
HumanEval/13
null
true
(unit tests)
def greatest_common_divisor(a: int, b: int) -> int: """ Return a greatest common divisor of two integers a and b >>> greatest_common_divisor(3, 5) 1 >>> greatest_common_divisor(25, 15)...
Complete the following Python function. Provide only the complete function implementation, no explanations. def greatest_common_divisor(a: int, b: int) -> int: """ Return a greatest common divisor of two integers a and b >>> greatest_common_divisor(3, 5) 1 >>> greatest_common_divisor(25, 15) 5 ...
The user wants a Python function that calculates the greatest common divisor (GCD) of two integers `a` and `b`. I should implement the Euclidean algorithm. The function signature is given: `def greatest_common_divisor(a: int, b: int) -> int:` I need to return only the complete function implementation, no explanations. ...
18.291
HumanEval/14
null
true
(unit tests)
from typing import List def all_prefixes(string: str) -> List[str]: return [string[:i] for i in range(1, len(string) + 1)]
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def all_prefixes(string: str) -> List[str]: """ Return list of all prefixes from shortest to longest of the input string >>> all_prefixes('abc') ['a', 'ab', 'abc'] """
The user wants a Python function that returns all prefixes of a given string, from shortest to longest. For example, `all_prefixes('abc')` should return `['a', 'ab', 'abc']`. Let's think about how to implement this. A prefix of a string `s` is `s[:i]` for `i` from 1 to `len(s)`. So we can use a list comprehension: `[s...
11.789
HumanEval/15
null
true
(unit tests)
def string_sequence(n: int) -> str: return ' '.join(map(str, range(n + 1)))
Complete the following Python function. Provide only the complete function implementation, no explanations. def string_sequence(n: int) -> str: """ Return a string containing space-delimited numbers starting from 0 upto n inclusive. >>> string_sequence(0) '0' >>> string_sequence(5) '0 1 2 3 4 5' ...
The user wants a Python function that takes an integer `n` and returns a string of numbers from 0 to `n` inclusive, separated by spaces. For example: `string_sequence(0)` -> `'0'` `string_sequence(5)` -> `'0 1 2 3 4 5'` I can achieve this by generating a range from 0 to `n+1`, converting each number to a string, and ...
13.239
HumanEval/16
null
true
(unit tests)
def count_distinct_characters(string: str) -> int: return len(set(string.lower()))
Complete the following Python function. Provide only the complete function implementation, no explanations. def count_distinct_characters(string: str) -> int: """ Given a string, find out how many distinct characters (regardless of case) does it consist of >>> count_distinct_characters('xyzXYZ') 3 >>...
The user wants a Python function that counts the number of distinct characters in a given string, ignoring case. The function signature is: `def count_distinct_characters(string: str) -> int:` I need to: 1. Convert the string to lowercase (or uppercase) to make it case-insensitive. 2. Find the number of distinct chara...
13.757
HumanEval/17
null
true
(unit tests)
from typing import List def parse_music(music_string: str) -> List[int]: mapping = {'o': 4, 'o|': 2, '.|': 1} return [mapping[note] for note in music_string.split()]
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def parse_music(music_string: str) -> List[int]: """ Input to this function is a string representing musical notes in a special ASCII format. Your task is to parse this string a...
The user wants a Python function `parse_music` that takes a string of musical notes and returns a list of integers representing their durations in beats. The mapping is: 'o' -> 4 'o|' -> 2 '.|' -> 1 The input string contains these notes separated by spaces. I need to split the string by spaces, map each token to its c...
16.415
HumanEval/18
null
true
(unit tests)
def how_many_times(string: str, substring: str) -> int: if not substring: return 0 count = 0 start = 0 while True: idx = string.find(substring, start) if idx ==...
Complete the following Python function. Provide only the complete function implementation, no explanations. def how_many_times(string: str, substring: str) -> int: """ Find how many times a given substring can be found in the original string. Count overlaping cases. >>> how_many_times('', 'a') 0 >>> ...
The user wants a Python function that counts the number of times a substring appears in a string, including overlapping occurrences. For example: - `how_many_times('', 'a')` -> 0 - `how_many_times('aaa', 'a')` -> 3 - `how_many_times('aaaa', 'aa')` -> 3 (indices 0, 1, 2) I need to implement this efficiently. A simple l...
43.567
HumanEval/19
null
true
(unit tests)
from typing import List def sort_numbers(numbers: str) -> str: """ Input is a space-delimited string of numberals from 'zero' to 'nine'. Valid choices are 'zero', 'one', 'two', 'three', 'four...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def sort_numbers(numbers: str) -> str: """ Input is a space-delimited string of numberals from 'zero' to 'nine'. Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five',...
The user wants a Python function that takes a space-delimited string of number words ('zero' to 'nine') and returns them sorted from smallest to largest. The input is a string like 'three one five'. The output should be a space-delimited string of the sorted number words: 'one three five'. Steps: 1. Define a mapping f...
26.203
HumanEval/20
null
true
(unit tests)
from typing import List, Tuple def find_closest_elements(numbers: List[float]) -> Tuple[float, float]: sorted_nums = sorted(numbers) min_diff = float('inf') closest_pair = (sorted_nums[0]...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List, Tuple def find_closest_elements(numbers: List[float]) -> Tuple[float, float]: """ From a supplied list of numbers (of length at least two) select and return two that are the closes...
The user wants a Python function that finds the two closest elements in a list of floats. The list has at least two elements. The function should return a tuple of the two closest numbers, ordered as (smaller, larger). If there are multiple pairs with the same minimum difference, any valid pair should work, but typical...
34.814
HumanEval/21
null
true
(unit tests)
from typing import List def rescale_to_unit(numbers: List[float]) -> List[float]: min_val = min(numbers) max_val = max(numbers) if max_val == min_val: return [0.0] * len(numbers) ...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def rescale_to_unit(numbers: List[float]) -> List[float]: """ Given list of numbers (of at least two elements), apply a linear transform to that list, such that the smallest num...
The user wants a Python function `rescale_to_unit` that takes a list of floats and rescales them linearly so that the minimum value becomes 0.0 and the maximum value becomes 1.0. The formula for linear rescaling is: `x_rescaled = (x - min_val) / (max_val - min_val)` We need to handle the case where `min_val == max_val`...
21.34
HumanEval/22
null
true
(unit tests)
from typing import List, Any def filter_integers(values: List[Any]) -> List[int]: return [x for x in values if type(x) is int]
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List, Any def filter_integers(values: List[Any]) -> List[int]: """ Filter given list of any python values only for integers >>> filter_integers(['a', 3.14, 5]) [5] >>> filter...
The user wants a Python function that filters a list of any type and returns only the integers. I need to check each element in the list and keep it if it's an integer. Note: In Python, `bool` is a subclass of `int`, so `isinstance(True, int)` is `True`. Usually, when filtering for integers, we might want to exclude bo...
18.878
HumanEval/23
null
true
(unit tests)
def strlen(string: str) -> int: return len(string)
Complete the following Python function. Provide only the complete function implementation, no explanations. def strlen(string: str) -> int: """ Return length of given string >>> strlen('') 0 >>> strlen('abc') 3 """
The user wants a Python function that calculates the length of a given string. The function signature is provided: `def strlen(string: str) -> int:` I need to return the length of the string. In Python, the built-in `len()` function does exactly this. So the implementation should be: ```python def strlen(string: str) -...
2.33
HumanEval/24
null
true
(unit tests)
def largest_divisor(n: int) -> int: for i in range(2, int(n**0.5) + 1): if n % i == 0: return n // i return 1
Complete the following Python function. Provide only the complete function implementation, no explanations. def largest_divisor(n: int) -> int: """ For a given number n, find the largest number that divides n evenly, smaller than n >>> largest_divisor(15) 5 """
The user wants a Python function `largest_divisor(n: int) -> int` that finds the largest divisor of `n` that is strictly less than `n`. The function should return an integer. Constraints/Assumptions: `n` is an integer. Usually, `n > 1` for this to make sense, but I'll assume valid input as per typical coding challenge ...
45.755
HumanEval/25
null
true
(unit tests)
from typing import List def factorize(n: int) -> List[int]: factors = [] d = 2 while d * d <= n: while n % d == 0: factors.append(d) n //= d d += 1...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def factorize(n: int) -> List[int]: """ Return list of prime factors of given integer in the order from smallest to largest. Each of the factors should be listed number of times...
The user wants a Python function `factorize(n: int) -> List[int]` that returns the prime factorization of a given integer `n`. The factors should be sorted from smallest to largest, and repeated according to their multiplicity. The product of the returned factors should equal `n`. Let's write the function: ```python d...
20.638
HumanEval/26
null
true
(unit tests)
from typing import List def remove_duplicates(numbers: List[int]) -> List[int]: counts = {} for num in numbers: counts[num] = counts.get(num, 0) + 1 return [num for num in numbers...
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def remove_duplicates(numbers: List[int]) -> List[int]: """ From a list of integers, remove all elements that occur more than once. Keep order of elements left the same as in th...
The user wants a Python function that removes all elements from a list that appear more than once. The order of the remaining elements should be preserved. Example: `[1, 2, 3, 2, 4]` -> `[1, 3, 4]` because `2` appears twice. Let's count the occurrences of each number. Then, iterate through the original list and keep o...
22.276
HumanEval/27
null
true
(unit tests)
def flip_case(string: str) -> str: """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase. >>> flip_case('Hello') 'hELLO' """ return string.swapc...
Complete the following Python function. Provide only the complete function implementation, no explanations. def flip_case(string: str) -> str: """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase. >>> flip_case('Hello') 'hELLO' """
The user wants a Python function `flip_case` that takes a string and swaps the case of each character. Lowercase becomes uppercase, uppercase becomes lowercase. Non-alphabetic characters should remain unchanged. The function should return the modified string. I can use Python's built-in string method `swapcase()`. Alt...
14.339
HumanEval/28
null
true
(unit tests)
from typing import List def concatenate(strings: List[str]) -> str: return "".join(strings)
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def concatenate(strings: List[str]) -> str: """ Concatenate list of strings into a single string >>> concatenate([]) '' >>> concatenate(['a', 'b', 'c']) 'abc' ""...
The user wants a Python function that concatenates a list of strings into a single string. The function signature is provided: ```python from typing import List def concatenate(strings: List[str]) -> str: """ Concatenate list of strings into a single string >>> concatenate([]) '' >>> concatenate(['a', ...
11.175
HumanEval/29
null
true
(unit tests)
from typing import List def filter_by_prefix(strings: List[str], prefix: str) -> List[str]: return [s for s in strings if s.startswith(prefix)]
Complete the following Python function. Provide only the complete function implementation, no explanations. from typing import List def filter_by_prefix(strings: List[str], prefix: str) -> List[str]: """ Filter an input list of strings only for ones that start with a given prefix. >>> filter_by_prefix([], 'a...
The user wants a Python function that filters a list of strings, keeping only those that start with a given prefix. I need to provide only the complete function implementation, no explanations. The function signature is: `def filter_by_prefix(strings: List[str], prefix: str) -> List[str]:` Implementation: ```python d...
3.486
HumanEval/30
null
true
(unit tests)
def get_positive(l: list): return [x for x in l if x > 0]
Complete the following Python function. Provide only the complete function implementation, no explanations. def get_positive(l: list): """Return only positive numbers in the list. >>> get_positive([-1, 2, -4, 5, 6]) [2, 5, 6] >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) [5, 3, 2, 3, ...
The user wants a Python function that filters a list of numbers and returns only the positive ones. Positive numbers are strictly greater than 0. The function signature is `def get_positive(l: list):`. I need to return a list containing only the elements `x` from `l` such that `x > 0`. Let's write it concisely using a...
15.201
HumanEval/31
null
true
(unit tests)
def is_prime(n): if n <= 1: return False if n == 2: return True if n % 2 == 0: return False for i in range(3, int(n**0.5) + 1, 2): if n % i == 0: ...
Complete the following Python function. Provide only the complete function implementation, no explanations. def is_prime(n): """Return true if a given number is prime, and false otherwise. >>> is_prime(6) False >>> is_prime(101) True >>> is_prime(11) True >>> is_prime(13441) True ...
The user wants a Python function `is_prime(n)` that checks if a number `n` is prime. I need to implement the function according to the docstring examples. Constraints/Edge cases from examples: - `is_prime(6)` -> False - `is_prime(101)` -> True - `is_prime(11)` -> True - `is_prime(13441)` -> True - `is_prime(61)` -> Tru...
22.618
End of preview.
README.md exists but content is empty.
Downloads last month
51