/**
 * Given a list of dictionaries where each dictionary represents a person with their name and age,
 * write a function that returns the average age of all the people in the list.
 *
 * @param people List of dictionaries representing people with their name and age
 * @return Float Average age of all the people
 *
 * Note:
 * - The age of each person is always a positive integer.
 * - The 'people' list is never empty.
 * - The 'people' list contains at least two dictionaries representing different people.
 */
fun averageAge(people: List<Map<String, Int>>): Float {

    var totalAge = 0
    var numPeople = 0

    for (personMap in people) {
        totalAge += personMap["age"] ?: 0
        numPeople++
    }

    val averageAge = totalAge.toFloat() / numPeople
    return averageAge
}
/**
 * Given a list of dictionaries where each dictionary represents a person with their name and age,
 * write a function that returns the average age of all the people in the list.
 *
 * @param people List of dictionaries representing people with their name and age
 * @return Float Average age of all the people
 *
 * Note:
 * - The age of each person is always a positive integer.
 * - The 'people' list is never empty.
 * - The 'people' list contains at least two dictionaries representing different people.
 */
fun averageAge(people: List<Map<String, Int>>): Float {
/**
 * Given a list of dictionaries where each dictionary represents a person with their name and age,
 * write a function that returns the average age of all the people in the list.
 *
 * @param people List of dictionaries representing people with their name and age
 * @return Float Average age of all the people
 *
 * Note:
 * - The age of each person is always a positive integer.
 * - The 'people' list is never empty.
 * - The 'people' list contains at least two dictionaries representing different people.
 */
fun averageAge(people: List<Map<String, Int>>): Float {

    var totalAge = 0
    var numPeople = 0

    for (personMap in people) {
        totalAge += personMap["age"] ?: 0
        numPeople++
    }

    val averageAge = totalAge.toFloat() / numPeople
    return averageAge
}