/**
 * Given a dictionary of mineral data, calculate the density for each mineral.
 */
fun calculateMineralDensity(mineralData: MutableMap<String, MutableMap<String, Double>>): MutableMap<String, MutableMap<String, Double>> {

    // Loop through each mineral in the dictionary
    for ((mineral, data) in mineralData) {
        // Obtain the mass and volume values for the current mineral
        val mass = data["mass"]
        val volume = data["volume"]

        // Check if the mass and volume are available for the current mineral
        if (mass != null && volume != null) {
            // Calculate the density using the mass and volume
            val density = mass / volume

            // Update the mineral data with the calculated density
            data["density"] = density
        }
    }

    return mineralData
}
/**
 * Given a dictionary of mineral data, calculate the density for each mineral.
 */
fun calculateMineralDensity(mineralData: MutableMap<String, MutableMap<String, Double>>): MutableMap<String, MutableMap<String, Double>> {
/**
 * Given a dictionary of mineral data, calculate the density for each mineral.
 */
fun calculateMineralDensity(mineralData: MutableMap<String, MutableMap<String, Double>>): MutableMap<String, MutableMap<String, Double>> {

    // Loop through each mineral in the dictionary
    for ((mineral, data) in mineralData) {
        // Obtain the mass and volume values for the current mineral
        val mass = data["mass"]
        val volume = data["volume"]

        // Check if the mass and volume are available for the current mineral
        if (mass != null && volume != null) {
            // Calculate the density using the mass and volume
            val density = mass / volume

            // Update the mineral data with the calculated density
            data["density"] = density
        }
    }

    return mineralData
}