llm-playground / foobar.txt
joshcarp
Initial huggingface commit
bcffb9c
Complete the 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
"""
def truncate_number(number: float) -> float:
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
//
// Return the decimal part of the number.
// >>> truncate_number 3.5 // 0.5