/**
 * This function calculates the population density for each country using the given population and area data.
 *
 * @param populationData A dictionary containing the population data for each country.
 * @param areaData A dictionary containing the area data for each country.
 * @return A dictionary with country names as keys and their corresponding population density as values.
 */
fun calculatePopulationDensity(populationData: Map<String, Int>, areaData: Map<String, Double>): Map<String, Double> {

    val populationDensityData = mutableMapOf<String, Double>()

    for ((country, population) in populationData) {
        val area = areaData[country] ?: 0.0
        val populationDensity = if (area > 0) population.toDouble() / area else 0.0
        populationDensityData[country] = populationDensity
    }

    return populationDensityData
}
/**
 * This function calculates the population density for each country using the given population and area data.
 *
 * @param populationData A dictionary containing the population data for each country.
 * @param areaData A dictionary containing the area data for each country.
 * @return A dictionary with country names as keys and their corresponding population density as values.
 */
fun calculatePopulationDensity(populationData: Map<String, Int>, areaData: Map<String, Double>): Map<String, Double> {
/**
 * This function calculates the population density for each country using the given population and area data.
 *
 * @param populationData A dictionary containing the population data for each country.
 * @param areaData A dictionary containing the area data for each country.
 * @return A dictionary with country names as keys and their corresponding population density as values.
 */
fun calculatePopulationDensity(populationData: Map<String, Int>, areaData: Map<String, Double>): Map<String, Double> {

    val populationDensityData = mutableMapOf<String, Double>()

    for ((country, population) in populationData) {
        val area = areaData[country] ?: 0.0
        val populationDensity = if (area > 0) population.toDouble() / area else 0.0
        populationDensityData[country] = populationDensity
    }

    return populationDensityData
}