id
stringlengths
32
34
content
stringlengths
309
3.16k
humaneval-x-python_data_Python_0
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(has_close_elements): assert has_close_elements([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True assert has_close_elements([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False assert has_close_elements([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True a...
humaneval-x-python_data_Python_1
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(separate_paren_groups): assert separate_paren_groups('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert separate_paren_groups('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((()...
humaneval-x-python_data_Python_2
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(truncate_number): assert truncate_number(3.5) == 0.5 assert abs(truncate_number(1.33) - 0.33) < 1e-6 assert abs(truncate_number(123.456) - 0.456) < 1e-6 check(truncate_number) def truncate_number(number: float) -> float: """ Give...
humaneval-x-python_data_Python_3
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(below_zero): assert below_zero([]) == False assert below_zero([1, 2, -3, 1, 2, -3]) == False assert below_zero([1, 2, -4, 5, 6]) == True assert below_zero([1, -1, 2, -2, 5, -5, 4, -4]) == False assert below_zero([1, -1, 2, -2, 5,...
humaneval-x-python_data_Python_4
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(mean_absolute_deviation): assert abs(mean_absolute_deviation([1.0, 2.0, 3.0]) - 2.0/3.0) < 1e-6 assert abs(mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) - 1.0) < 1e-6 assert abs(mean_absolute_deviation([1.0, 2.0, 3.0, 4.0, 5.0]) - 6.0/5....
humaneval-x-python_data_Python_5
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(intersperse): assert intersperse([], 7) == [] assert intersperse([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert intersperse([2, 2, 2], 2) == [2, 2, 2, 2, 2] check(intersperse) from typing import List def intersperse(numbers: List[i...
humaneval-x-python_data_Python_6
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(parse_nested_parens): assert parse_nested_parens('(()()) ((())) () ((())()())') == [2, 3, 1, 3] assert parse_nested_parens('() (()) ((())) (((())))') == [1, 2, 3, 4] assert parse_nested_parens('(()(())((())))') == [4] check(parse_nested...
humaneval-x-python_data_Python_7
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(filter_by_substring): assert filter_by_substring([], 'john') == [] assert filter_by_substring(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx'] assert filter_by_substring(['xxx', 'asd', 'aaaxxy', 'joh...
humaneval-x-python_data_Python_8
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(sum_product): assert sum_product([]) == (0, 1) assert sum_product([1, 1, 1]) == (3, 1) assert sum_product([100, 0]) == (100, 0) assert sum_product([3, 5, 7]) == (3 + 5 + 7, 3 * 5 * 7) assert sum_product([10]) == (10, 10) check(s...
humaneval-x-python_data_Python_9
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(rolling_max): assert rolling_max([]) == [] assert rolling_max([1, 2, 3, 4]) == [1, 2, 3, 4] assert rolling_max([4, 3, 2, 1]) == [4, 4, 4, 4] assert rolling_max([3, 2, 3, 100, 3]) == [3, 3, 3, 100, 100] check(rolling_max) from typin...
humaneval-x-python_data_Python_10
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(make_palindrome): assert make_palindrome('') == '' assert make_palindrome('x') == 'x' assert make_palindrome('xyz') == 'xyzyx' assert make_palindrome('xyx') == 'xyx' assert make_palindrome('jerry') == 'jerryrrej' check(make_pali...
humaneval-x-python_data_Python_11
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(string_xor): assert string_xor('111000', '101010') == '010010' assert string_xor('1', '1') == '0' assert string_xor('0101', '0000') == '0101' check(string_xor) from typing import List def string_xor(a: str, b: str) -> str: """ In...
humaneval-x-python_data_Python_12
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(longest): assert longest([]) == None assert longest(['x', 'y', 'z']) == 'x' assert longest(['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']) == 'zzzz' check(longest) from typing import List, Optional def longest(strings: List[str]) -> Opti...
humaneval-x-python_data_Python_13
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(greatest_common_divisor): assert greatest_common_divisor(3, 7) == 1 assert greatest_common_divisor(10, 15) == 5 assert greatest_common_divisor(49, 14) == 7 assert greatest_common_divisor(144, 60) == 12 check(greatest_common_divisor)...
humaneval-x-python_data_Python_14
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(all_prefixes): assert all_prefixes('') == [] assert all_prefixes('asdfgh') == ['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh'] assert all_prefixes('WWW') == ['W', 'WW', 'WWW'] check(all_prefixes) from typing import List def all_prefixes...
humaneval-x-python_data_Python_15
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(string_sequence): assert string_sequence(0) == '0' assert string_sequence(3) == '0 1 2 3' assert string_sequence(10) == '0 1 2 3 4 5 6 7 8 9 10' check(string_sequence) def string_sequence(n: int) -> str: """ Return a string conta...
humaneval-x-python_data_Python_16
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(count_distinct_characters): assert count_distinct_characters('') == 0 assert count_distinct_characters('abcde') == 5 assert count_distinct_characters('abcde' + 'cade' + 'CADE') == 5 assert count_distinct_characters('aaaaAAAAaaaa') ==...
humaneval-x-python_data_Python_17
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(parse_music): assert parse_music('') == [] assert parse_music('o o o o') == [4, 4, 4, 4] assert parse_music('.| .| .| .|') == [1, 1, 1, 1] assert parse_music('o| o| .| .| o o o o') == [2, 2, 1, 1, 4, 4, 4, 4] assert parse_music('...
humaneval-x-python_data_Python_18
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(how_many_times): assert how_many_times('', 'x') == 0 assert how_many_times('xyxyxyx', 'x') == 4 assert how_many_times('cacacacac', 'cac') == 4 assert how_many_times('john doe', 'john') == 1 check(how_many_times) def how_many_time...
humaneval-x-python_data_Python_19
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(sort_numbers): assert sort_numbers('') == '' assert sort_numbers('three') == 'three' assert sort_numbers('three five nine') == 'three five nine' assert sort_numbers('five zero four seven nine eight') == 'zero four five seven eight ni...
humaneval-x-python_data_Python_20
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(find_closest_elements): assert find_closest_elements([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0) assert find_closest_elements([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9) assert find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0...
humaneval-x-python_data_Python_21
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(rescale_to_unit): assert rescale_to_unit([2.0, 49.9]) == [0.0, 1.0] assert rescale_to_unit([100.0, 49.9]) == [1.0, 0.0] assert rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0] assert rescale_to_unit([2.0, 1.0...
humaneval-x-python_data_Python_22
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(filter_integers): assert filter_integers([]) == [] assert filter_integers([4, {}, [], 23.2, 9, 'adasd']) == [4, 9] assert filter_integers([3, 'c', 3, 3, 'a', 'b']) == [3, 3, 3] check(filter_integers) from typing import List, Any def ...
humaneval-x-python_data_Python_23
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(strlen): assert strlen('') == 0 assert strlen('x') == 1 assert strlen('asdasnakj') == 9 check(strlen) def strlen(string: str) -> int: """ Return length of given string >>> strlen('') 0 >>> strlen('abc') 3 """ ...
humaneval-x-python_data_Python_24
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(largest_divisor): assert largest_divisor(3) == 1 assert largest_divisor(7) == 1 assert largest_divisor(10) == 5 assert largest_divisor(100) == 50 assert largest_divisor(49) == 7 check(largest_divisor) def largest_divisor(n: i...
humaneval-x-python_data_Python_25
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(factorize): assert factorize(2) == [2] assert factorize(4) == [2, 2] assert factorize(8) == [2, 2, 2] assert factorize(3 * 19) == [3, 19] assert factorize(3 * 19 * 3 * 19) == [3, 3, 19, 19] assert factorize(3 * 19 * 3 * 19 * ...
humaneval-x-python_data_Python_26
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(remove_duplicates): assert remove_duplicates([]) == [] assert remove_duplicates([1, 2, 3, 4]) == [1, 2, 3, 4] assert remove_duplicates([1, 2, 3, 2, 4, 3, 5]) == [1, 4, 5] check(remove_duplicates) from typing import List def remove_du...
humaneval-x-python_data_Python_27
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(flip_case): assert flip_case('') == '' assert flip_case('Hello!') == 'hELLO!' assert flip_case('These violent delights have violent ends') == 'tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS' check(flip_case) def flip_case(string: str) -> s...
humaneval-x-python_data_Python_28
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(concatenate): assert concatenate([]) == '' assert concatenate(['x', 'y', 'z']) == 'xyz' assert concatenate(['x', 'y', 'z', 'w', 'k']) == 'xyzwk' check(concatenate) from typing import List def concatenate(strings: List[str]) -> str: ...
humaneval-x-python_data_Python_29
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(filter_by_prefix): assert filter_by_prefix([], 'john') == [] assert filter_by_prefix(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx'] check(filter_by_prefix) from typing import List def filter_by_pre...
humaneval-x-python_data_Python_30
METADATA = {} def check(get_positive): assert get_positive([-1, -2, 4, 5, 6]) == [4, 5, 6] assert get_positive([5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 3, 9, 123, 1] assert get_positive([-1, -2]) == [] assert get_positive([]) == [] check(get_positive) def get_positive(l: list): ...
humaneval-x-python_data_Python_31
METADATA = {} def check(is_prime): assert is_prime(6) == False assert is_prime(101) == True assert is_prime(11) == True assert is_prime(13441) == True assert is_prime(61) == True assert is_prime(4) == False assert is_prime(1) == False assert is_prime(5) == True assert is_prime(11...
humaneval-x-python_data_Python_32
METADATA = {} def check(find_zero): import math import random rng = random.Random(42) import copy for _ in range(100): ncoeff = 2 * rng.randint(1, 4) coeffs = [] for _ in range(ncoeff): coeff = rng.randint(-10, 10) if coeff == 0: co...
humaneval-x-python_data_Python_33
METADATA = {} def check(sort_third): assert tuple(sort_third([1, 2, 3])) == tuple(sort_third([1, 2, 3])) assert tuple(sort_third([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple(sort_third([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) assert tuple(sort_third([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tupl...
humaneval-x-python_data_Python_34
METADATA = {} def check(unique): assert unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123] check(unique) def unique(l: list): """Return sorted unique elements in a list >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) [0, 2, 3, 5, 9, 123] """ return sorted(list(set(l)))
humaneval-x-python_data_Python_35
METADATA = {} def check(max_element): assert max_element([1, 2, 3]) == 3 assert max_element([5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10]) == 124 check(max_element) def max_element(l: list): """Return maximum element in the list. >>> max_element([1, 2, 3]) 3 >>> max_element([5, 3, -5, 2, -3, 3...
humaneval-x-python_data_Python_36
METADATA = {} def check(fizz_buzz): assert fizz_buzz(50) == 0 assert fizz_buzz(78) == 2 assert fizz_buzz(79) == 3 assert fizz_buzz(100) == 3 assert fizz_buzz(200) == 6 assert fizz_buzz(4000) == 192 assert fizz_buzz(10000) == 639 assert fizz_buzz(100000) == 8026 check(fizz_buzz) d...
humaneval-x-python_data_Python_37
METADATA = {} def check(sort_even): assert tuple(sort_even([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(sort_even([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(sort_even([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 1...
humaneval-x-python_data_Python_38
METADATA = {} def check(decode_cyclic): from random import randint, choice import string letters = string.ascii_lowercase for _ in range(100): str = ''.join(choice(letters) for i in range(randint(10, 20))) encoded_str = encode_cyclic(str) assert decode_cyclic(encoded_str) ==...
humaneval-x-python_data_Python_39
METADATA = {} def check(prime_fib): assert prime_fib(1) == 2 assert prime_fib(2) == 3 assert prime_fib(3) == 5 assert prime_fib(4) == 13 assert prime_fib(5) == 89 assert prime_fib(6) == 233 assert prime_fib(7) == 1597 assert prime_fib(8) == 28657 assert prime_fib(9) == 514229 ...
humaneval-x-python_data_Python_40
METADATA = {} def check(triples_sum_to_zero): assert triples_sum_to_zero([1, 3, 5, 0]) == False assert triples_sum_to_zero([1, 3, 5, -1]) == False assert triples_sum_to_zero([1, 3, -2, 1]) == True assert triples_sum_to_zero([1, 2, 3, 7]) == False assert triples_sum_to_zero([1, 2, 5, 7]) == False...
humaneval-x-python_data_Python_41
METADATA = {} def check(car_race_collision): assert car_race_collision(2) == 4 assert car_race_collision(3) == 9 assert car_race_collision(4) == 16 assert car_race_collision(8) == 64 assert car_race_collision(10) == 100 check(car_race_collision) def car_race_collision(n: int): """ Im...
humaneval-x-python_data_Python_42
METADATA = {} def check(incr_list): assert incr_list([]) == [] assert incr_list([3, 2, 1]) == [4, 3, 2] assert incr_list([5, 2, 5, 2, 3, 3, 9, 0, 123]) == [6, 3, 6, 3, 4, 4, 10, 1, 124] check(incr_list) def incr_list(l: list): """Return list with elements incremented by 1. >>> incr_list([1, ...
humaneval-x-python_data_Python_43
METADATA = {} def check(pairs_sum_to_zero): assert pairs_sum_to_zero([1, 3, 5, 0]) == False assert pairs_sum_to_zero([1, 3, -2, 1]) == False assert pairs_sum_to_zero([1, 2, 3, 7]) == False assert pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) == True assert pairs_sum_to_zero([1]) == False assert pa...
humaneval-x-python_data_Python_44
METADATA = {} def check(change_base): assert change_base(8, 3) == "22" assert change_base(9, 3) == "100" assert change_base(234, 2) == "11101010" assert change_base(16, 2) == "10000" assert change_base(8, 2) == "1000" assert change_base(7, 2) == "111" for x in range(2, 8): assert...
humaneval-x-python_data_Python_45
METADATA = {} def check(triangle_area): assert triangle_area(5, 3) == 7.5 assert triangle_area(2, 2) == 2.0 assert triangle_area(10, 8) == 40.0 check(triangle_area) def triangle_area(a, h): """Given length of a side and high return area for a triangle. >>> triangle_area(5, 3) 7.5 """...
humaneval-x-python_data_Python_46
METADATA = {} def check(fib4): assert fib4(5) == 4 assert fib4(8) == 28 assert fib4(10) == 104 assert fib4(12) == 386 check(fib4) def fib4(n: int): """The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: fib4(0) -> 0 fib4(1) -> 0 fi...
humaneval-x-python_data_Python_47
METADATA = {} def check(median): assert median([3, 1, 2, 4, 5]) == 3 assert median([-10, 4, 6, 1000, 10, 20]) == 8.0 assert median([5]) == 5 assert median([6, 5]) == 5.5 assert median([8, 1, 3, 9, 9, 2, 7]) == 7 check(median) def median(l: list): """Return median of elements in the list ...
humaneval-x-python_data_Python_48
METADATA = {} def check(is_palindrome): assert is_palindrome('') == True assert is_palindrome('aba') == True assert is_palindrome('aaaaa') == True assert is_palindrome('zbcd') == False assert is_palindrome('xywyx') == True assert is_palindrome('xywyz') == False assert is_palindrome('xywz...
humaneval-x-python_data_Python_49
METADATA = {} def check(modp): assert modp(3, 5) == 3 assert modp(1101, 101) == 2 assert modp(0, 101) == 1 assert modp(3, 11) == 8 assert modp(100, 101) == 1 assert modp(30, 5) == 4 assert modp(31, 5) == 3 check(modp) def modp(n: int, p: int): """Return 2^n modulo p (be aware of ...
humaneval-x-python_data_Python_50
METADATA = {} def check(decode_shift): from random import randint, choice import copy import string letters = string.ascii_lowercase for _ in range(100): str = ''.join(choice(letters) for i in range(randint(10, 20))) encoded_str = encode_shift(str) assert decode_shift(co...
humaneval-x-python_data_Python_51
METADATA = {} def check(remove_vowels): assert remove_vowels('') == '' assert remove_vowels("abcdef\nghijklm") == 'bcdf\nghjklm' assert remove_vowels('fedcba') == 'fdcb' assert remove_vowels('eeeee') == '' assert remove_vowels('acBAA') == 'cB' assert remove_vowels('EcBOO') == 'cB' assert...
humaneval-x-python_data_Python_52
METADATA = {} def check(below_threshold): assert below_threshold([1, 2, 4, 10], 100) assert not below_threshold([1, 20, 4, 10], 5) assert below_threshold([1, 20, 4, 10], 21) assert below_threshold([1, 20, 4, 10], 22) assert below_threshold([1, 8, 4, 10], 11) assert not below_threshold([1, 8,...
humaneval-x-python_data_Python_53
METADATA = {} def check(add): import random assert add(0, 1) == 1 assert add(1, 0) == 1 assert add(2, 3) == 5 assert add(5, 7) == 12 assert add(7, 5) == 12 for i in range(100): x, y = random.randint(0, 1000), random.randint(0, 1000) assert add(x, y) == x + y check(add)...
humaneval-x-python_data_Python_54
METADATA = {} def check(same_chars): assert same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc') == True assert same_chars('abcd', 'dddddddabc') == True assert same_chars('dddddddabc', 'abcd') == True assert same_chars('eabcd', 'dddddddabc') == False assert same_chars('abcd', 'dddddddabcf') == False ...
humaneval-x-python_data_Python_55
METADATA = {} def check(fib): assert fib(10) == 55 assert fib(1) == 1 assert fib(8) == 21 assert fib(11) == 89 assert fib(12) == 144 check(fib) def fib(n: int): """Return n-th Fibonacci number. >>> fib(10) 55 >>> fib(1) 1 >>> fib(8) 21 """ if n == 0: ...
humaneval-x-python_data_Python_56
METADATA = {} def check(correct_bracketing): assert correct_bracketing("<>") assert correct_bracketing("<<><>>") assert correct_bracketing("<><><<><>><>") assert correct_bracketing("<><><<<><><>><>><<><><<>>>") assert not correct_bracketing("<<<><>>>>") assert not correct_bracketing("><<>") ...
humaneval-x-python_data_Python_57
METADATA = {} def check(monotonic): assert monotonic([1, 2, 4, 10]) == True assert monotonic([1, 2, 4, 20]) == True assert monotonic([1, 20, 4, 10]) == False assert monotonic([4, 1, 0, -10]) == True assert monotonic([4, 1, 1, 0]) == True assert monotonic([1, 2, 3, 2, 5, 60]) == False ass...
humaneval-x-python_data_Python_58
METADATA = {} def check(common): assert common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653] assert common([5, 3, 2, 8], [3, 2]) == [2, 3] assert common([4, 3, 2, 8], [3, 2, 4]) == [2, 3, 4] assert common([4, 3, 2, 8], []) == [] check(common) def common(l1: list, l2: list):...
humaneval-x-python_data_Python_59
METADATA = {} def check(largest_prime_factor): assert largest_prime_factor(15) == 5 assert largest_prime_factor(27) == 3 assert largest_prime_factor(63) == 7 assert largest_prime_factor(330) == 11 assert largest_prime_factor(13195) == 29 check(largest_prime_factor) def largest_prime_factor(n...
humaneval-x-python_data_Python_60
METADATA = {} def check(sum_to_n): assert sum_to_n(1) == 1 assert sum_to_n(6) == 21 assert sum_to_n(11) == 66 assert sum_to_n(30) == 465 assert sum_to_n(100) == 5050 check(sum_to_n) def sum_to_n(n: int): """sum_to_n is a function that sums numbers from 1 to n. >>> sum_to_n(30) 46...
humaneval-x-python_data_Python_61
METADATA = {} def check(correct_bracketing): assert correct_bracketing("()") assert correct_bracketing("(()())") assert correct_bracketing("()()(()())()") assert correct_bracketing("()()((()()())())(()()(()))") assert not correct_bracketing("((()())))") assert not correct_bracketing(")(()") ...
humaneval-x-python_data_Python_62
METADATA = {} def check(derivative): assert derivative([3, 1, 2, 4, 5]) == [1, 4, 12, 20] assert derivative([1, 2, 3]) == [2, 6] assert derivative([3, 2, 1]) == [2, 2] assert derivative([3, 2, 1, 0, 4]) == [2, 2, 0, 16] assert derivative([1]) == [] check(derivative) def derivative(xs: list):...
humaneval-x-python_data_Python_63
METADATA = {} def check(fibfib): assert fibfib(2) == 1 assert fibfib(1) == 0 assert fibfib(5) == 4 assert fibfib(8) == 24 assert fibfib(10) == 81 assert fibfib(12) == 274 assert fibfib(14) == 927 check(fibfib) def fibfib(n: int): """The FibFib number sequence is a sequence simila...
humaneval-x-python_data_Python_64
def check(vowels_count): # Check some simple cases assert vowels_count("abcde") == 2, "Test 1" assert vowels_count("Alone") == 3, "Test 2" assert vowels_count("key") == 2, "Test 3" assert vowels_count("bye") == 1, "Test 4" assert vowels_count("keY") == 2, "Test 5" assert vowels_count("bYe")...
humaneval-x-python_data_Python_65
def check(circular_shift): # Check some simple cases assert circular_shift(100, 2) == "001" assert circular_shift(12, 2) == "12" assert circular_shift(97, 8) == "79" assert circular_shift(12, 1) == "21", "This prints if this assert fails 1 (good for debugging!)" # Check some edge cases that ar...
humaneval-x-python_data_Python_66
def check(digitSum): # Check some simple cases assert True, "This prints if this assert fails 1 (good for debugging!)" assert digitSum("") == 0, "Error" assert digitSum("abAB") == 131, "Error" assert digitSum("abcCd") == 67, "Error" assert digitSum("helloE") == 69, "Error" assert digitSum("...
humaneval-x-python_data_Python_67
def check(fruit_distribution): # Check some simple cases assert fruit_distribution("5 apples and 6 oranges",19) == 8 assert fruit_distribution("5 apples and 6 oranges",21) == 10 assert fruit_distribution("0 apples and 1 oranges",3) == 2 assert fruit_distribution("1 apples and 0 oranges",3) == 2 ...
humaneval-x-python_data_Python_68
def check(pluck): # Check some simple cases assert True, "This prints if this assert fails 1 (good for debugging!)" assert pluck([4,2,3]) == [2, 1], "Error" assert pluck([1,2,3]) == [2, 1], "Error" assert pluck([]) == [], "Error" assert pluck([5, 0, 3, 0, 4, 2]) == [0, 1], "Error" # Check ...
humaneval-x-python_data_Python_69
def check(search): # manually generated tests assert search([5, 5, 5, 5, 1]) == 1 assert search([4, 1, 4, 1, 4, 4]) == 4 assert search([3, 3]) == -1 assert search([8, 8, 8, 8, 8, 8, 8, 8]) == 8 assert search([2, 3, 3, 2, 2]) == 2 # automatically generated tests assert search([2, 7, 8, ...
humaneval-x-python_data_Python_70
def check(strange_sort_list): # Check some simple cases assert strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3] assert strange_sort_list([5, 6, 7, 8, 9]) == [5, 9, 6, 8, 7] assert strange_sort_list([1, 2, 3, 4, 5]) == [1, 5, 2, 4, 3] assert strange_sort_list([5, 6, 7, 8, 9, 1]) == [1, 9, 5, 8, 6, 7]...
humaneval-x-python_data_Python_71
def check(triangle_area): # Check some simple cases assert triangle_area(3, 4, 5) == 6.00, "This prints if this assert fails 1 (good for debugging!)" assert triangle_area(1, 2, 10) == -1 assert triangle_area(4, 8, 5) == 8.18 assert triangle_area(2, 2, 2) == 1.73 assert triangle_area(1, 2, 3) ==...
humaneval-x-python_data_Python_72
def check(will_it_fly): # Check some simple cases assert will_it_fly([3, 2, 3], 9) is True assert will_it_fly([1, 2], 5) is False assert will_it_fly([3], 5) is True assert will_it_fly([3, 2, 3], 1) is False # Check some edge cases that are easy to work out by hand. assert will_it_fly([1, ...
humaneval-x-python_data_Python_73
def check(smallest_change): # Check some simple cases assert smallest_change([1,2,3,5,4,7,9,6]) == 4 assert smallest_change([1, 2, 3, 4, 3, 2, 2]) == 1 assert smallest_change([1, 4, 2]) == 1 assert smallest_change([1, 4, 4, 2]) == 1 # Check some edge cases that are easy to work out by hand. ...
humaneval-x-python_data_Python_74
def check(total_match): # Check some simple cases assert True, "This prints if this assert fails 1 (good for debugging!)" assert total_match([], []) == [] assert total_match(['hi', 'admin'], ['hi', 'hi']) == ['hi', 'hi'] assert total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) == ['hi'...
humaneval-x-python_data_Python_75
def check(is_multiply_prime): assert is_multiply_prime(5) == False assert is_multiply_prime(30) == True assert is_multiply_prime(8) == True assert is_multiply_prime(10) == False assert is_multiply_prime(125) == True assert is_multiply_prime(3 * 5 * 7) == True assert is_multiply_prime(3 * 6 ...
humaneval-x-python_data_Python_76
def check(is_simple_power): # Check some simple cases assert is_simple_power(1, 4)== True, "This prints if this assert fails 1 (good for debugging!)" assert is_simple_power(2, 2)==True, "This prints if this assert fails 1 (good for debugging!)" assert is_simple_power(8, 2)==True, "This prints if this a...
humaneval-x-python_data_Python_77
def check(iscube): # Check some simple cases assert iscube(1) == True, "First test error: " + str(iscube(1)) assert iscube(2) == False, "Second test error: " + str(iscube(2)) assert iscube(-1) == True, "Third test error: " + str(iscube(-1)) assert iscube(64) == True, "Fourth test error: " + str(isc...
humaneval-x-python_data_Python_78
def check(hex_key): # Check some simple cases assert hex_key("AB") == 1, "First test error: " + str(hex_key("AB")) assert hex_key("1077E") == 2, "Second test error: " + str(hex_key("1077E")) assert hex_key("ABED1A33") == 4, "Third test error: " + str(hex_key("ABED1A33")) assert hex_ke...
humaneval-x-python_data_Python_79
def check(decimal_to_binary): # Check some simple cases assert decimal_to_binary(0) == "db0db" assert decimal_to_binary(32) == "db100000db" assert decimal_to_binary(103) == "db1100111db" assert decimal_to_binary(15) == "db1111db", "This prints if this assert fails 1 (good for debugging!)" # Ch...
humaneval-x-python_data_Python_80
def check(is_happy): # Check some simple cases assert is_happy("a") == False , "a" assert is_happy("aa") == False , "aa" assert is_happy("abcd") == True , "abcd" assert is_happy("aabb") == False , "aabb" assert is_happy("adb") == True , "adb" assert is_happy("xyy") == False , "xyy" asse...
humaneval-x-python_data_Python_81
def check(numerical_letter_grade): # Check some simple cases assert numerical_letter_grade([4.0, 3, 1.7, 2, 3.5]) == ['A+', 'B', 'C-', 'C', 'A-'] assert numerical_letter_grade([1.2]) == ['D+'] assert numerical_letter_grade([0.5]) == ['D-'] assert numerical_letter_grade([0.0]) == ['E'] assert nu...
humaneval-x-python_data_Python_82
def check(prime_length): # Check some simple cases assert prime_length('Hello') == True assert prime_length('abcdcba') == True assert prime_length('kittens') == True assert prime_length('orange') == False assert prime_length('wow') == True assert prime_length('world') == True assert pri...
humaneval-x-python_data_Python_83
def check(starts_one_ends): # Check some simple cases assert True, "This prints if this assert fails 1 (good for debugging!)" assert starts_one_ends(1) == 1 assert starts_one_ends(2) == 18 assert starts_one_ends(3) == 180 assert starts_one_ends(4) == 1800 assert starts_one_ends(5) == 18000 ...
humaneval-x-python_data_Python_84
def check(solve): # Check some simple cases assert True, "This prints if this assert fails 1 (good for debugging!)" assert solve(1000) == "1", "Error" assert solve(150) == "110", "Error" assert solve(147) == "1100", "Error" # Check some edge cases that are easy to work out by hand. assert ...
humaneval-x-python_data_Python_85
def check(add): # Check some simple cases assert add([4, 88]) == 88 assert add([4, 5, 6, 7, 2, 122]) == 122 assert add([4, 0, 6, 7]) == 0 assert add([4, 4, 6, 8]) == 12 # Check some edge cases that are easy to work out by hand. check(add) def add(lst): """Given a non-empty list of integ...
humaneval-x-python_data_Python_86
def check(anti_shuffle): # Check some simple cases assert anti_shuffle('Hi') == 'Hi' assert anti_shuffle('hello') == 'ehllo' assert anti_shuffle('number') == 'bemnru' assert anti_shuffle('abcd') == 'abcd' assert anti_shuffle('Hello World!!!') == 'Hello !!!Wdlor' assert anti_shuffle('') == '...
humaneval-x-python_data_Python_87
def check(get_row): # Check some simple cases assert get_row([ [1,2,3,4,5,6], [1,2,3,4,1,6], [1,2,3,4,5,1] ], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)] assert get_row([ [1,2,3,4,5,6], [1,2,3,4,5,6], [1,2,3,4,5,6], [1,2,3,4,5,6], [1,2,...
humaneval-x-python_data_Python_88
def check(sort_array): # Check some simple cases assert True, "This prints if this assert fails 1 (good for debugging!)" assert sort_array([]) == [], "Error" assert sort_array([5]) == [5], "Error" assert sort_array([2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5], "Error" assert sort_array([2, 4, 3, 0...
humaneval-x-python_data_Python_89
def check(encrypt): # Check some simple cases assert encrypt('hi') == 'lm', "This prints if this assert fails 1 (good for debugging!)" assert encrypt('asdfghjkl') == 'ewhjklnop', "This prints if this assert fails 1 (good for debugging!)" assert encrypt('gf') == 'kj', "This prints if this assert fails 1...
humaneval-x-python_data_Python_90
def check(next_smallest): # Check some simple cases assert next_smallest([1, 2, 3, 4, 5]) == 2 assert next_smallest([5, 1, 4, 3, 2]) == 2 assert next_smallest([]) == None assert next_smallest([1, 1]) == None assert next_smallest([1,1,1,1,0]) == 1 assert next_smallest([1, 0**0]) == None ...
humaneval-x-python_data_Python_91
def check(is_bored): # Check some simple cases assert is_bored("Hello world") == 0, "Test 1" assert is_bored("Is the sky blue?") == 0, "Test 2" assert is_bored("I love It !") == 1, "Test 3" assert is_bored("bIt") == 0, "Test 4" assert is_bored("I feel good today. I will be productive. will kill...
humaneval-x-python_data_Python_92
def check(any_int): # Check some simple cases assert any_int(2, 3, 1)==True, "This prints if this assert fails 1 (good for debugging!)" assert any_int(2.5, 2, 3)==False, "This prints if this assert fails 2 (good for debugging!)" assert any_int(1.5, 5, 3.5)==False, "This prints if this assert fails 3 (g...
humaneval-x-python_data_Python_93
def check(encode): # Check some simple cases assert encode('TEST') == 'tgst', "This prints if this assert fails 1 (good for debugging!)" assert encode('Mudasir') == 'mWDCSKR', "This prints if this assert fails 2 (good for debugging!)" assert encode('YES') == 'ygs', "This prints if this assert fails 3 (...
humaneval-x-python_data_Python_94
def check(skjkasdkd): # Check some simple cases assert skjkasdkd([0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3]) == 10, "This prints if this assert fails 1 (good for debugging!)" # Check some edge cases that are easy to work out by hand. assert skjkasdkd([1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1]...
humaneval-x-python_data_Python_95
def check(check_dict_case): # Check some simple cases assert check_dict_case({"p":"pineapple", "b":"banana"}) == True, "First test error: " + str(check_dict_case({"p":"pineapple", "b":"banana"})) assert check_dict_case({"p":"pineapple", "A":"banana", "B":"banana"}) == False, "Second test error: " + str(che...
humaneval-x-python_data_Python_96
def check(count_up_to): assert count_up_to(5) == [2,3] assert count_up_to(6) == [2,3,5] assert count_up_to(7) == [2,3,5] assert count_up_to(10) == [2,3,5,7] assert count_up_to(0) == [] assert count_up_to(22) == [2,3,5,7,11,13,17,19] assert count_up_to(1) == [] assert count_up_to(18) == ...
humaneval-x-python_data_Python_97
def check(multiply): # Check some simple cases assert multiply(148, 412) == 16, "First test error: " + str(multiply(148, 412)) assert multiply(19, 28) == 72, "Second test error: " + str(multiply(19, 28)) assert multiply(2020, 1851) == 0, "Third test error: " + str(multipl...
humaneval-x-python_data_Python_98
def check(count_upper): # Check some simple cases assert count_upper('aBCdEf') == 1 assert count_upper('abcdefg') == 0 assert count_upper('dBBE') == 0 assert count_upper('B') == 0 assert count_upper('U') == 1 assert count_upper('') == 0 assert count_upper('EEEE') == 2 # Check so...
humaneval-x-python_data_Python_99
def check(closest_integer): # Check some simple cases assert closest_integer("10") == 10, "Test 1" assert closest_integer("14.5") == 15, "Test 2" assert closest_integer("-15.5") == -16, "Test 3" assert closest_integer("15.3") == 15, "Test 3" # Check some edge cases that are easy to work out by...