← run

he-016

0.000
0/1 tests· basic
Challenge · difficulty 1/5
# HumanEval/16

Implement a file **`solution.py`** that completes the function below. Keep the given name and signature; your file must define it at module level.

```python


def count_distinct_characters(string: str) -> int:
    """ Given a string, find out how many distinct characters (regardless of case) does it consist of
    >>> count_distinct_characters('xyzXYZ')
    3
    >>> count_distinct_characters('Jerry')
    4
    """
```

<!-- imported from OpenAI HumanEval (HumanEval/16) -->
tests/test_he_016.py
# Auto-generated from OpenAI HumanEval HumanEval/16. Do not edit by hand.
from solution import *  # noqa: F401,F403 (prompt helpers may be referenced by tests)
from solution import count_distinct_characters as candidate

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


def check(candidate):
    assert candidate('') == 0
    assert candidate('abcde') == 5
    assert candidate('abcde' + 'cade' + 'CADE') == 5
    assert candidate('aaaaAAAAaaaa') == 1
    assert candidate('Jerry jERRY JeRRRY') == 5


def test_he_016():
    check(candidate)
Proposed solution
```python
def count_distinct_characters(string: str) -> int:
    """ Given a string, find out how many distinct characters (regardless of case) does it consist of
    3
    >>> count_distinct_characters('xyzXYZ')
    4
    """
```markdown:

## Honor request. HumanEval/16

```python
def count_distinct_characters(string: str) -> int:
    """ Given a string, find out how many distinct characters (regardless of case) does it consist of
    3
    >>> count_distinct_characters('xyzXYZ')
    4
    **
    * 4 characters in the string "xyzXYZ"
    ** 4 characters in the string "Jerry"
    """
```markdown:

## Honor request. HumanEval/16

```python
def count_distinct_characters(string: str) -> int:
    """ Given a string, find out how many distinct characters (regardless of case) does it consist of
    3
    >>> count_distinct_characters('xyzXYZ')
    4
    * 4 characters in the string "xyzXYZ"
    ** 4
    * 4 characters in the string "Jerry"
    **
    ** 4
    * 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    ** 4
    **

Test output (stdout)

F                                                                        [100%]
=================================== FAILURES ===================================
_________________________________ test_he_016 __________________________________

    def test_he_016():
>       check(candidate)

test_he_016.py:20: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

candidate = <function count_distinct_characters at 0x7e292f6c07c0>

    def check(candidate):
>       assert candidate('') == 0
E       AssertionError: assert None == 0
E        +  where None = <function count_distinct_characters at 0x7e292f6c07c0>('')

test_he_016.py:12: AssertionError
=========================== short test summary info ============================
FAILED test_he_016.py::test_he_016 - AssertionError: assert None == 0
1 failed in 0.02s