/**
 * Given a list of patient data, calculate the average age of the patients.
 */
fun calculateAvgPatientAge(patientData: List<List<Pair<String, Int>>>): Double {

    var totalPatientCount = 0
    var totalAge = 0

    for (dataSet in patientData) {
        for (patient in dataSet) {
            // Check if the patient's age is non-negative using a conditional expression
            totalAge += if (patient.second >= 0) patient.second else 0
            totalPatientCount++
        }
    }

    val averageAge = totalAge.toDouble() / totalPatientCount
    return averageAge
}
/**
 * Given a list of patient data, calculate the average age of the patients.
 */
fun calculateAvgPatientAge(patientData: List<List<Pair<String, Int>>>): Double {
/**
 * Given a list of patient data, calculate the average age of the patients.
 */
fun calculateAvgPatientAge(patientData: List<List<Pair<String, Int>>>): Double {

    var totalPatientCount = 0
    var totalAge = 0

    for (dataSet in patientData) {
        for (patient in dataSet) {
            // Check if the patient's age is non-negative using a conditional expression
            totalAge += if (patient.second >= 0) patient.second else 0
            totalPatientCount++
        }
    }

    val averageAge = totalAge.toDouble() / totalPatientCount
    return averageAge
}