/**
 * Given a list of dictionaries containing information about astronomical objects, extract only the objects
 * that have a distance greater than 1000 light-years from Earth and return them in a set.
 *
 * @param data A list of dictionaries. Each dictionary represents an astronomical object and contains
 *             the keys 'name' (String), 'distance' (Double), and 'type' (String).
 * @return A set containing the names of astronomical objects that are farther than 1000 light-years from Earth.
 */
fun extractAstronomicalObjects(data: List<Map<String, Any>>): Set<String> {

    val astronomicalObjects = mutableSetOf<String>()

    // Iterate over each dictionary in the list
    for (obj in data) {
        // Check if the distance is greater than 1000
        if (obj["distance"] as Double > 1000) {
            astronomicalObjects.add(obj["name"] as String)  // Add the name to the set
        }
    }

    return astronomicalObjects
}
/**
 * Given a list of dictionaries containing information about astronomical objects, extract only the objects
 * that have a distance greater than 1000 light-years from Earth and return them in a set.
 *
 * @param data A list of dictionaries. Each dictionary represents an astronomical object and contains
 *             the keys 'name' (String), 'distance' (Double), and 'type' (String).
 * @return A set containing the names of astronomical objects that are farther than 1000 light-years from Earth.
 */
fun extractAstronomicalObjects(data: List<Map<String, Any>>): Set<String> {
/**
 * Given a list of dictionaries containing information about astronomical objects, extract only the objects
 * that have a distance greater than 1000 light-years from Earth and return them in a set.
 *
 * @param data A list of dictionaries. Each dictionary represents an astronomical object and contains
 *             the keys 'name' (String), 'distance' (Double), and 'type' (String).
 * @return A set containing the names of astronomical objects that are farther than 1000 light-years from Earth.
 */
fun extractAstronomicalObjects(data: List<Map<String, Any>>): Set<String> {

    val astronomicalObjects = mutableSetOf<String>()

    // Iterate over each dictionary in the list
    for (obj in data) {
        // Check if the distance is greater than 1000
        if (obj["distance"] as Double > 1000) {
            astronomicalObjects.add(obj["name"] as String)  // Add the name to the set
        }
    }

    return astronomicalObjects
}