/**
 * Given a dictionary, update the values of all items based on the following conditions:
 *
 * 1. If the value is a number, square it.
 * 2. If the value is a list, append the string 'updated' to each element.
 * 3. If the value is a boolean, toggle its value (True -> False; False -> True).
 *
 * @param dictionary The dictionary to be modified.
 * @return The modified dictionary.
 */
fun updateValues(dictionary: MutableMap<String, Any>): MutableMap<String, Any> {

    for ((key, value) in dictionary) {
        when (value) {
            is Int, is Double -> dictionary[key] = (value as Number).toDouble() * (value as Number).toDouble()
            is List<*> -> dictionary[key] = (value as List<*>).map { it.toString() + " updated" }
            is Boolean -> dictionary[key] = !(value as Boolean)
        }
    }
    return dictionary
}
/**
 * Given a dictionary, update the values of all items based on the following conditions:
 *
 * 1. If the value is a number, square it.
 * 2. If the value is a list, append the string 'updated' to each element.
 * 3. If the value is a boolean, toggle its value (True -> False; False -> True).
 *
 * @param dictionary The dictionary to be modified.
 * @return The modified dictionary.
 */
fun updateValues(dictionary: MutableMap<String, Any>): MutableMap<String, Any> {
/**
 * Given a dictionary, update the values of all items based on the following conditions:
 *
 * 1. If the value is a number, square it.
 * 2. If the value is a list, append the string 'updated' to each element.
 * 3. If the value is a boolean, toggle its value (True -> False; False -> True).
 *
 * @param dictionary The dictionary to be modified.
 * @return The modified dictionary.
 */
fun updateValues(dictionary: MutableMap<String, Any>): MutableMap<String, Any> {

    for ((key, value) in dictionary) {
        when (value) {
            is Int, is Double -> dictionary[key] = (value as Number).toDouble() * (value as Number).toDouble()
            is List<*> -> dictionary[key] = (value as List<*>).map { it.toString() + " updated" }
            is Boolean -> dictionary[key] = !(value as Boolean)
        }
    }
    return dictionary
}