/**
 * This exercise is about updating the customer data using an if statement and modifying values in a dictionary.
 *
 * You are working as a Marketing Manager and your task is to update the specific customer data by increasing the number
 * of purchases they have made. The customer data is stored in a nested dictionary where customer IDs are the keys of the
 * outer dictionary, and each customer ID maps to another dictionary containing the customer details. Your job is to
 * increment the 'purchases' value of the customer with the given customer_id.
 *
 * Complete the code below to solve the exercise.
 */
fun updateCustomerData(customerData: MutableMap<Int, MutableMap<String, Any>>, customerId: Int): MutableMap<Int, MutableMap<String, Any>> {

    // Get the customer details based on the customer_id
    val customer = customerData[customerId]

    // Check if the customer exists
    if (customer != null) {
        // Increment the 'purchases' value by 1
        customer["purchases"] = (customer["purchases"] as Int) + 1
    }

    return customerData
}
/**
 * This exercise is about updating the customer data using an if statement and modifying values in a dictionary.
 *
 * You are working as a Marketing Manager and your task is to update the specific customer data by increasing the number
 * of purchases they have made. The customer data is stored in a nested dictionary where customer IDs are the keys of the
 * outer dictionary, and each customer ID maps to another dictionary containing the customer details. Your job is to
 * increment the 'purchases' value of the customer with the given customer_id.
 *
 * Complete the code below to solve the exercise.
 */
fun updateCustomerData(customerData: MutableMap<Int, MutableMap<String, Any>>, customerId: Int): MutableMap<Int, MutableMap<String, Any>> {
/**
 * This exercise is about updating the customer data using an if statement and modifying values in a dictionary.
 *
 * You are working as a Marketing Manager and your task is to update the specific customer data by increasing the number
 * of purchases they have made. The customer data is stored in a nested dictionary where customer IDs are the keys of the
 * outer dictionary, and each customer ID maps to another dictionary containing the customer details. Your job is to
 * increment the 'purchases' value of the customer with the given customer_id.
 *
 * Complete the code below to solve the exercise.
 */
fun updateCustomerData(customerData: MutableMap<Int, MutableMap<String, Any>>, customerId: Int): MutableMap<Int, MutableMap<String, Any>> {

    // Get the customer details based on the customer_id
    val customer = customerData[customerId]

    // Check if the customer exists
    if (customer != null) {
        // Increment the 'purchases' value by 1
        customer["purchases"] = (customer["purchases"] as Int) + 1
    }

    return customerData
}