/**
 * This exercise aims to test the understanding of dictionary methods and handling floating-point errors using epsilon.
 * Given a dictionary and a key, complete the function to check if the key exists in the dictionary.
 *
 * @param dictionary The dictionary to search for the key.
 * @param key The key to check for existence in the dictionary.
 * @return True if the key exists in the dictionary, False otherwise.
 */
fun checkDictionary(dictionary: Map<Double, Any>, key: Double): Boolean {

    // Check if the key exactly exists in the dictionary
    if (key in dictionary) {
        return true
    }

    // Iterate through the dictionary keys and check if they are close to the given key
    for (dictKey in dictionary.keys) {
        if (Math.abs(dictKey - key) <= 1e-9) {  // Floating-point error tolerance using epsilon
            return true
        }
    }

    return false
}
/**
 * This exercise aims to test the understanding of dictionary methods and handling floating-point errors using epsilon.
 * Given a dictionary and a key, complete the function to check if the key exists in the dictionary.
 *
 * @param dictionary The dictionary to search for the key.
 * @param key The key to check for existence in the dictionary.
 * @return True if the key exists in the dictionary, False otherwise.
 */
fun checkDictionary(dictionary: Map<Double, Any>, key: Double): Boolean {
/**
 * This exercise aims to test the understanding of dictionary methods and handling floating-point errors using epsilon.
 * Given a dictionary and a key, complete the function to check if the key exists in the dictionary.
 *
 * @param dictionary The dictionary to search for the key.
 * @param key The key to check for existence in the dictionary.
 * @return True if the key exists in the dictionary, False otherwise.
 */
fun checkDictionary(dictionary: Map<Double, Any>, key: Double): Boolean {

    // Check if the key exactly exists in the dictionary
    if (key in dictionary) {
        return true
    }

    // Iterate through the dictionary keys and check if they are close to the given key
    for (dictKey in dictionary.keys) {
        if (Math.abs(dictKey - key) <= 1e-9) {  // Floating-point error tolerance using epsilon
            return true
        }
    }

    return false
}