/**
 * This function calculates the intersection of two sets using a combination of the for loop and other functions.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2, represented as a list.
 *
 * Note:
 * - The function assumes that the input sets contain only unique elements.
 * - The function does not preserve the order of the elements in the intersection.
 */
fun calculateIntersection(set1: Set<Any>, set2: Set<Any>): List<Any> {

    val intersection = mutableListOf<Any>()

    // Iterate over each element in set1
    for (elem1 in set1) {
        // Check if the element is also present in set2
        if (elem1 in set2) {
            // Add the element to the intersection list
            intersection.add(elem1)
        }
    }

    // Return the intersection list
    return intersection
}
/**
 * This function calculates the intersection of two sets using a combination of the for loop and other functions.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2, represented as a list.
 *
 * Note:
 * - The function assumes that the input sets contain only unique elements.
 * - The function does not preserve the order of the elements in the intersection.
 */
fun calculateIntersection(set1: Set<Any>, set2: Set<Any>): List<Any> {
/**
 * This function calculates the intersection of two sets using a combination of the for loop and other functions.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2, represented as a list.
 *
 * Note:
 * - The function assumes that the input sets contain only unique elements.
 * - The function does not preserve the order of the elements in the intersection.
 */
fun calculateIntersection(set1: Set<Any>, set2: Set<Any>): List<Any> {

    val intersection = mutableListOf<Any>()

    // Iterate over each element in set1
    for (elem1 in set1) {
        // Check if the element is also present in set2
        if (elem1 in set2) {
            // Add the element to the intersection list
            intersection.add(elem1)
        }
    }

    // Return the intersection list
    return intersection
}