/**
 * Given a dictionary, iterate over it and format the keys and values 
 * as specified in the exercise requirements.
 *
 * @param dictionary A dictionary containing key-value pairs.
 * @return A list containing the formatted keys and values from the dictionary.
 */
fun iterateAndFormat(dictionary: Map<String, String>): List<String> {

    val result = mutableListOf<String>()
    
    // Iterate over the dictionary
    for ((key, value) in dictionary) {
        // Format the key and value as per requirements
        val formattedKey = "Key: $key"
        val formattedValue = "Value: $value"
        
        // Add the formatted key and value to the result list
        result.add(formattedKey)
        result.add(formattedValue)
    }
    
    return result
}

// Exercise
// Given the following dictionary, iterate over it and format the keys
// and values as specified below, then return the formatted strings as a list.
// Dictionary: {'apple': 'fruit', 'carrot': 'vegetable', 'banana': 'fruit'}
// Format:
// Key: <key>
// Value: <value>

val result = iterateAndFormat(mapOf("apple" to "fruit", "carrot" to "vegetable", "banana" to "fruit"))
/**
 * Given a dictionary, iterate over it and format the keys and values 
 * as specified in the exercise requirements.
 *
 * @param dictionary A dictionary containing key-value pairs.
 * @return A list containing the formatted keys and values from the dictionary.
 */
fun iterateAndFormat(dictionary: Map<String, String>): List<String> {
/**
 * Given a dictionary, iterate over it and format the keys and values 
 * as specified in the exercise requirements.
 *
 * @param dictionary A dictionary containing key-value pairs.
 * @return A list containing the formatted keys and values from the dictionary.
 */
fun iterateAndFormat(dictionary: Map<String, String>): List<String> {

    val result = mutableListOf<String>()
    
    // Iterate over the dictionary
    for ((key, value) in dictionary) {
        // Format the key and value as per requirements
        val formattedKey = "Key: $key"
        val formattedValue = "Value: $value"
        
        // Add the formatted key and value to the result list
        result.add(formattedKey)
        result.add(formattedValue)
    }
    
    return result
}

// Exercise
// Given the following dictionary, iterate over it and format the keys
// and values as specified below, then return the formatted strings as a list.
// Dictionary: {'apple': 'fruit', 'carrot': 'vegetable', 'banana': 'fruit'}
// Format:
// Key: <key>
// Value: <value>

val result = iterateAndFormat(mapOf("apple" to "fruit", "carrot" to "vegetable", "banana" to "fruit"))