/**
 * This function takes in three lists - names, ages, and genders - and combines them into a dictionary.
 * The names list contains the names of the patients as strings.
 * The ages list contains the ages of the patients as integers.
 * The genders list contains the genders of the patients as strings ('Male' or 'Female').
 *
 * @param names List of patient names.
 * @param ages List of patient ages.
 * @param genders List of patient genders.
 * @return A dictionary where the keys are the names of the patients and the values are dictionaries
 * containing the age and gender of the patients.
 */
fun createPatientDictionary(names: List<String>, ages: List<Int>, genders: List<String>): Map<String, Map<String, Any>> {

    // Check if the lengths of the input lists match
    require(names.size == ages.size && names.size == genders.size) { "Input lists must have the same length" }

    // Initialize an empty dictionary to store the patient information
    val patientDictionary = mutableMapOf<String, Map<String, Any>>()

    // Iterate over the lists and create the dictionary entries
    for (i in names.indices) {
        val name = names[i]
        val age = ages[i]
        val gender = genders[i]

        if (name !in patientDictionary) {
            patientDictionary[name] = mapOf("age" to age, "gender" to gender)
        }
    }

    return patientDictionary
}
/**
 * This function takes in three lists - names, ages, and genders - and combines them into a dictionary.
 * The names list contains the names of the patients as strings.
 * The ages list contains the ages of the patients as integers.
 * The genders list contains the genders of the patients as strings ('Male' or 'Female').
 *
 * @param names List of patient names.
 * @param ages List of patient ages.
 * @param genders List of patient genders.
 * @return A dictionary where the keys are the names of the patients and the values are dictionaries
 * containing the age and gender of the patients.
 */
fun createPatientDictionary(names: List<String>, ages: List<Int>, genders: List<String>): Map<String, Map<String, Any>> {
/**
 * This function takes in three lists - names, ages, and genders - and combines them into a dictionary.
 * The names list contains the names of the patients as strings.
 * The ages list contains the ages of the patients as integers.
 * The genders list contains the genders of the patients as strings ('Male' or 'Female').
 *
 * @param names List of patient names.
 * @param ages List of patient ages.
 * @param genders List of patient genders.
 * @return A dictionary where the keys are the names of the patients and the values are dictionaries
 * containing the age and gender of the patients.
 */
fun createPatientDictionary(names: List<String>, ages: List<Int>, genders: List<String>): Map<String, Map<String, Any>> {

    // Check if the lengths of the input lists match
    require(names.size == ages.size && names.size == genders.size) { "Input lists must have the same length" }

    // Initialize an empty dictionary to store the patient information
    val patientDictionary = mutableMapOf<String, Map<String, Any>>()

    // Iterate over the lists and create the dictionary entries
    for (i in names.indices) {
        val name = names[i]
        val age = ages[i]
        val gender = genders[i]

        if (name !in patientDictionary) {
            patientDictionary[name] = mapOf("age" to age, "gender" to gender)
        }
    }

    return patientDictionary
}