Skip to content

Latest commit

 

History

History
158 lines (156 loc) · 4.16 KB

File metadata and controls

158 lines (156 loc) · 4.16 KB

Results of Code LLama 34B on HumanEval/27

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

Prompt

def flip_case(string: str) -> str:
    """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
    >>> flip_case('Hello')
    'hELLO'
    """

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

Correct solution

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.swapcase()

Unit tests

METADATA = {
    'author': 'jt',
    'dataset': 'test'
}


def check(candidate):
    assert candidate('') == ''
    assert candidate('Hello!') == 'hELLO!'
    assert candidate('These violent delights have violent ends') == 'tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS'

Runs

✅ Run 1

Start time: 2023-09-01 02:48:13
Duration: 4.68s
Result: Pass

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.swapcase()

✅ Run 2

Start time: 2023-09-01 02:51:13
Duration: 5.37s
Result: Pass

def flip_case(string: str) -> str:
    """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
    >>> flip_case('Hello')
    'hELLO'
    """
    return ''.join([c.lower() if c.isupper() else c.upper() for c in string])

✅ Run 3

Start time: 2023-09-01 02:54:08
Duration: 5.66s
Result: Pass

def flip_case(string: str) -> str:
    """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
    >>> flip_case('Hello')
    'hELLO'
    """
    return ''.join([c.lower() if c.isupper() else c.upper() for c in string])

✅ Run 4

Start time: 2023-09-01 02:57:08
Duration: 4.62s
Result: Pass

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.swapcase()

✅ Run 5

Start time: 2023-09-01 03:00:06
Duration: 5.04s
Result: Pass

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.swapcase()

✅ Run 6

Start time: 2023-09-01 03:03:07
Duration: 5.99s
Result: Pass

def flip_case(string: str) -> str:
    """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
    >>> flip_case('Hello')
    'hELLO'
    """
    return ''.join(c.lower() if c.isupper() else c.upper() for c in string)

✅ Run 7

Start time: 2023-09-01 03:06:10
Duration: 3.86s
Result: Pass

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.swapcase()

✅ Run 8

Start time: 2023-09-01 03:09:17
Duration: 4.41s
Result: Pass

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.swapcase()

✅ Run 9

Start time: 2023-09-01 03:12:08
Duration: 4.27s
Result: Pass

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.swapcase()

✅ Run 10

Start time: 2023-09-01 03:15:12
Duration: 4.81s
Result: Pass

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.swapcase()