Skip to content

Latest commit

 

History

History
214 lines (209 loc) · 4.65 KB

File metadata and controls

214 lines (209 loc) · 4.65 KB

Results of Code LLama 34B on HumanEval/155

Date: 01 September, 2023
Model: codellama-34b-instruct
Temperature: 0.2
Passing runs: 0
Total runs: 10
Success rate: 0%

Prompt

def even_odd_count(num):
    """Given an integer. return a tuple that has the number of even and odd digits respectively.

     Example:
        even_odd_count(-12) ==> (1, 1)
        even_odd_count(123) ==> (1, 2)
    """

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

Correct solution

def even_odd_count(num):
    """Given an integer. return a tuple that has the number of even and odd digits respectively.

     Example:
        even_odd_count(-12) ==> (1, 1)
        even_odd_count(123) ==> (1, 2)
    """even_count = 0
    odd_count = 0
    for i in str(abs(num)):
        if int(i)%2==0:
            even_count +=1
        else:
            odd_count +=1
    return (even_count, odd_count)

Unit tests

def check(candidate):

    # Check some simple cases
    assert candidate(7) == (0, 1)
    assert candidate(-78) == (1, 1)
    assert candidate(3452) == (2, 2)
    assert candidate(346211) == (3, 3)
    assert candidate(-345821) == (3, 3)
    assert candidate(-2) == (1, 0)
    assert candidate(-45347) == (2, 3)
    assert candidate(0) == (1, 0)


    # Check some edge cases that are easy to work out by hand.
    assert True

Runs

❌ Run 1

Start time: 2023-09-01 02:46:01
Duration: 5.45s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 2

Start time: 2023-09-01 02:48:55
Duration: 5.27s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 3

Start time: 2023-09-01 02:51:53
Duration: 5.27s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 4

Start time: 2023-09-01 02:54:46
Duration: 4.78s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 5

Start time: 2023-09-01 02:57:45
Duration: 5.28s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 6

Start time: 2023-09-01 03:00:46
Duration: 5.27s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 7

Start time: 2023-09-01 03:03:48
Duration: 5.12s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 8

Start time: 2023-09-01 03:06:50
Duration: 6.65s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 9

Start time: 2023-09-01 03:09:53
Duration: 4.95s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)

❌ Run 10

Start time: 2023-09-01 03:12:51
Duration: 5.21s
Result: Fail

def even_odd_count(num):
    even_count = 0
    odd_count = 0
    while num > 0:
        if num % 2 == 0:
            even_count += 1
        else:
            odd_count += 1
        num //= 10
    return (even_count, odd_count)