Skip to content

Latest commit

 

History

History
188 lines (180 loc) · 4.94 KB

File metadata and controls

188 lines (180 loc) · 4.94 KB

Results of GPT-3.5 on HumanEval/133

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

Prompt

Tokens: 183

def sum_squares(lst):
    """You are given a list of numbers.
    You need to return the sum of squared numbers in the given list,
    round each element in the list to the upper int(Ceiling) first.
    Examples:
    For lst = [1,2,3] the output should be 14
    For lst = [1,4,9] the output should be 98
    For lst = [1,3,5,7] the output should be 84
    For lst = [1.4,4.2,0] the output should be 29
    For lst = [-2.4,1,1] the output should be 6
    

    """

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

Correct solution

def sum_squares(lst):
    """You are given a list of numbers.
    You need to return the sum of squared numbers in the given list,
    round each element in the list to the upper int(Ceiling) first.
    Examples:
    For lst = [1,2,3] the output should be 14
    For lst = [1,4,9] the output should be 98
    For lst = [1,3,5,7] the output should be 84
    For lst = [1.4,4.2,0] the output should be 29
    For lst = [-2.4,1,1] the output should be 6
    

    """import math
    squared = 0
    for i in lst:
        squared += math.ceil(i)**2
    return squared

Unit tests

def check(candidate):

    # Check some simple cases
    assert candidate([1,2,3])==14, "This prints if this assert fails 1 (good for debugging!)"
    assert candidate([1.0,2,3])==14, "This prints if this assert fails 1 (good for debugging!)"
    assert candidate([1,3,5,7])==84, "This prints if this assert fails 1 (good for debugging!)"
    assert candidate([1.4,4.2,0])==29, "This prints if this assert fails 1 (good for debugging!)"
    assert candidate([-2.4,1,1])==6, "This prints if this assert fails 1 (good for debugging!)"

    assert candidate([100,1,15,2])==10230, "This prints if this assert fails 1 (good for debugging!)"
    assert candidate([10000,10000])==200000000, "This prints if this assert fails 1 (good for debugging!)"
    assert candidate([-1.4,4.6,6.3])==75, "This prints if this assert fails 1 (good for debugging!)"
    assert candidate([-1.4,17.9,18.9,19.9])==1086, "This prints if this assert fails 1 (good for debugging!)"


    # Check some edge cases that are easy to work out by hand.
    assert candidate([0])==0, "This prints if this assert fails 2 (also good for debugging!)"
    assert candidate([-1])==1, "This prints if this assert fails 2 (also good for debugging!)"
    assert candidate([-1,1,0])==2, "This prints if this assert fails 2 (also good for debugging!)"

Runs

❌ Run 1

Start time: 2023-07-18 17:05:47
Duration: 1.67s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 2

Start time: 2023-07-18 17:05:45
Duration: 1.65s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 3

Start time: 2023-07-18 17:05:44
Duration: 1.82s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 4

Start time: 2023-07-18 17:05:42
Duration: 1.63s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 5

Start time: 2023-07-18 17:05:40
Duration: 1.94s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 6

Start time: 2023-07-18 17:05:38
Duration: 2.08s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 7

Start time: 2023-07-18 17:05:36
Duration: 1.97s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 8

Start time: 2023-07-18 17:05:34
Duration: 2.04s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 9

Start time: 2023-07-18 17:05:32
Duration: 1.93s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total

❌ Run 10

Start time: 2023-07-18 17:05:30
Duration: 2.0s
Completion tokens: 31
Result: Fail

def sum_squares(lst):
    total = 0
    for num in lst:
        total += int(num) ** 2
    return total