Skip to content

Latest commit

 

History

History
211 lines (207 loc) · 4.9 KB

File metadata and controls

211 lines (207 loc) · 4.9 KB

Results of GPT-3.5 on HumanEval/100

Date: 18 July, 2023
Model: gpt-3.5-turbo
Temperature: 0.2
Passing runs: 0
Total runs: 10
Success rate: 0%

Prompt

Tokens: 158

def make_a_pile(n):
    """
    Given a positive integer n, you have to make a pile of n levels of stones.
    The first level has n stones.
    The number of stones in the next level is:
        - the next odd number if n is odd.
        - the next even number if n is even.
    Return the number of stones in each level in a list, where element at index
    i represents the number of stones in the level (i+1).

    Examples:
    >>> make_a_pile(3)
    [3, 5, 7]
    """

The above is an incomplete Python code fragment. Return the complete and correct code with no additional text.

Correct solution

def make_a_pile(n):
    """
    Given a positive integer n, you have to make a pile of n levels of stones.
    The first level has n stones.
    The number of stones in the next level is:
        - the next odd number if n is odd.
        - the next even number if n is even.
    Return the number of stones in each level in a list, where element at index
    i represents the number of stones in the level (i+1).

    Examples:
    >>> make_a_pile(3)
    [3, 5, 7]
    """return [n + 2*i for i in range(n)]

Unit tests

def check(candidate):

    # Check some simple cases
    assert candidate(3) == [3, 5, 7], "Test 3"
    assert candidate(4) == [4,6,8,10], "Test 4"
    assert candidate(5) == [5, 7, 9, 11, 13]
    assert candidate(6) == [6, 8, 10, 12, 14, 16]
    assert candidate(8) == [8, 10, 12, 14, 16, 18, 20, 22]

    # Check some edge cases that are easy to work out by hand.
    assert True, "This prints if this assert fails 2 (also good for debugging!)"

Runs

❌ Run 1

Start time: 2023-07-18 17:12:40
Duration: 3.17s
Completion tokens: 55
Result: Fail

def make_a_pile(n):
    pile = []
    for i in range(n):
        if n % 2 == 0:
            pile.append(n + 2*i)
        else:
            pile.append(n + 2*i + 1)
    return pile

❌ Run 2

Start time: 2023-07-18 17:12:38
Duration: 2.45s
Completion tokens: 55
Result: Fail

def make_a_pile(n):
    pile = []
    for i in range(n):
        if n % 2 == 0:
            pile.append(n + 2*i)
        else:
            pile.append(n + 2*i + 1)
    return pile

❌ Run 3

Start time: 2023-07-18 17:12:35
Duration: 3.0s
Completion tokens: 62
Result: Fail

def make_a_pile(n):
    stones = [n]
    for i in range(n-1):
        if n % 2 == 0:
            stones.append(stones[-1] + 2)
        else:
            stones.append(stones[-1] + 1)
    return stones

❌ Run 4

Start time: 2023-07-18 17:12:32
Duration: 3.02s
Completion tokens: 55
Result: Fail

def make_a_pile(n):
    pile = []
    for i in range(n):
        if n % 2 == 0:
            pile.append(n + 2*i)
        else:
            pile.append(n + 2*i + 1)
    return pile

❌ Run 5

Start time: 2023-07-18 17:12:29
Duration: 2.75s
Completion tokens: 55
Result: Fail

def make_a_pile(n):
    pile = []
    for i in range(n):
        if n % 2 == 0:
            pile.append(n + 2*i)
        else:
            pile.append(n + 2*i + 1)
    return pile

❌ Run 6

Start time: 2023-07-18 17:12:26
Duration: 2.81s
Completion tokens: 62
Result: Fail

def make_a_pile(n):
    stones = [n]
    for i in range(n-1):
        if n % 2 == 0:
            stones.append(stones[-1] + 2)
        else:
            stones.append(stones[-1] + 1)
    return stones

❌ Run 7

Start time: 2023-07-18 17:12:23
Duration: 2.47s
Completion tokens: 55
Result: Fail

def make_a_pile(n):
    pile = []
    for i in range(n):
        if n % 2 == 0:
            pile.append(n + 2*i)
        else:
            pile.append(n + 2*i + 1)
    return pile

❌ Run 8

Start time: 2023-07-18 17:12:20
Duration: 2.87s
Completion tokens: 55
Result: Fail

def make_a_pile(n):
    pile = [n]
    for i in range(n-1):
        if n % 2 == 0:
            n += 1
        else:
            n += 2
        pile.append(n)
    return pile

❌ Run 9

Start time: 2023-07-18 17:12:17
Duration: 2.92s
Completion tokens: 68
Result: Fail

def make_a_pile(n):
    stones = [n]
    for i in range(n-1):
        if n % 2 == 0:
            stones.append(stones[-1] + 2)
        else:
            stones.append(stones[-1] + 1)
        n += 1
    return stones

❌ Run 10

Start time: 2023-07-18 17:12:14
Duration: 2.95s
Completion tokens: 68
Result: Fail

def make_a_pile(n):
    stones = [n]
    for i in range(n-1):
        if n % 2 == 0:
            stones.append(stones[-1] + 2)
        else:
            stones.append(stones[-1] + 1)
        n += 1
    return stones