Created
June 6, 2023 05:34
Example H2O Prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<|prompt|> | |
Complete the following Python code: | |
Notes: respond with the entire complete function definition | |
do not add any comments, be as concise in your code as possible | |
use only built-in libraries, assume no additional imports other than those provided (if any) | |
code: | |
from typing import List | |
def has_close_elements(numbers: List[float], threshold: float) -> bool: | |
""" Check if in given list of numbers, are any two numbers closer to each other than | |
given threshold. | |
>>> has_close_elements([1.0, 2.0, 3.0], 0.5) | |
False | |
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) | |
True | |
""" | |
<|endoftext|><|answer|> | |
```python | |
def has_close_elements( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment