/**
 * This exercise requires iterating through a dictionary and using the precedence of logical operators.
 * In this exercise, you need to loop through the given dictionary and perform some complex operations.
 * Your task is to complete the code to check if a certain condition is met and append the value to the result list.
 * Read the instructions carefully and implement the logic accordingly. Good luck!
 */
fun iterateDictionary(dictionary: Map<String, Int>): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate through each key-value pair in the given dictionary
    for ((key, value) in dictionary) {
        // Check if the key contains the letter 'a' AND the value is greater than 10 OR the key length is divisible by 3
        // If the condition holds true, append the value to the result list
        if ((key.contains('a') && value > 10) || key.length % 3 == 0) {
            result.add(value)
        }
    }

    return result
}

// Dictionary to use for testing the code
val myDictionary = mapOf("apple" to 15, "banana" to 8, "cherry" to 12, "kiwi" to 5, "orange" to 20)
/**
 * This exercise requires iterating through a dictionary and using the precedence of logical operators.
 * In this exercise, you need to loop through the given dictionary and perform some complex operations.
 * Your task is to complete the code to check if a certain condition is met and append the value to the result list.
 * Read the instructions carefully and implement the logic accordingly. Good luck!
 */
fun iterateDictionary(dictionary: Map<String, Int>): List<Int> {
/**
 * This exercise requires iterating through a dictionary and using the precedence of logical operators.
 * In this exercise, you need to loop through the given dictionary and perform some complex operations.
 * Your task is to complete the code to check if a certain condition is met and append the value to the result list.
 * Read the instructions carefully and implement the logic accordingly. Good luck!
 */
fun iterateDictionary(dictionary: Map<String, Int>): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate through each key-value pair in the given dictionary
    for ((key, value) in dictionary) {
        // Check if the key contains the letter 'a' AND the value is greater than 10 OR the key length is divisible by 3
        // If the condition holds true, append the value to the result list
        if ((key.contains('a') && value > 10) || key.length % 3 == 0) {
            result.add(value)
        }
    }

    return result
}

// Dictionary to use for testing the code
val myDictionary = mapOf("apple" to 15, "banana" to 8, "cherry" to 12, "kiwi" to 5, "orange" to 20)