/**
 * This exercise tests your knowledge of looping through sets using a for loop and performing multiplication operations.
 * Your task is to implement a function that takes two sets as input and returns the intersection of the two sets, along with the product of all the elements in the intersection.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A Pair containing the intersection of the two sets and the product of all elements in the intersection.
 *
 * Example:
 * '``
 * val set1 = setOf(1, 2, 3, 4, 5)
 * val set2 = setOf(4, 5, 6, 7, 8)
 * println(intersectionLoopMultiplication(set1, set2)) // Output: Pair(setOf(4, 5), 20)
 * '``
 *
 * Make sure to handle special cases such as empty sets or sets containing non-numeric elements.
 *
 * Good luck!
 */
fun intersectionLoopMultiplication(set1: Set<Any>, set2: Set<Any>): Pair<Set<Any>, Int> {

    val intersection = set1.intersect(set2)
    var product = 1

    for (element in intersection) {
        if (element is Int || element is Double) {
            product *= element as Int
        }
    }

    return Pair(intersection, product)
}
/**
 * This exercise tests your knowledge of looping through sets using a for loop and performing multiplication operations.
 * Your task is to implement a function that takes two sets as input and returns the intersection of the two sets, along with the product of all the elements in the intersection.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A Pair containing the intersection of the two sets and the product of all elements in the intersection.
 *
 * Example:
 * '``
 * val set1 = setOf(1, 2, 3, 4, 5)
 * val set2 = setOf(4, 5, 6, 7, 8)
 * println(intersectionLoopMultiplication(set1, set2)) // Output: Pair(setOf(4, 5), 20)
 * '``
 *
 * Make sure to handle special cases such as empty sets or sets containing non-numeric elements.
 *
 * Good luck!
 */
fun intersectionLoopMultiplication(set1: Set<Any>, set2: Set<Any>): Pair<Set<Any>, Int> {
/**
 * This exercise tests your knowledge of looping through sets using a for loop and performing multiplication operations.
 * Your task is to implement a function that takes two sets as input and returns the intersection of the two sets, along with the product of all the elements in the intersection.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A Pair containing the intersection of the two sets and the product of all elements in the intersection.
 *
 * Example:
 * '``
 * val set1 = setOf(1, 2, 3, 4, 5)
 * val set2 = setOf(4, 5, 6, 7, 8)
 * println(intersectionLoopMultiplication(set1, set2)) // Output: Pair(setOf(4, 5), 20)
 * '``
 *
 * Make sure to handle special cases such as empty sets or sets containing non-numeric elements.
 *
 * Good luck!
 */
fun intersectionLoopMultiplication(set1: Set<Any>, set2: Set<Any>): Pair<Set<Any>, Int> {

    val intersection = set1.intersect(set2)
    var product = 1

    for (element in intersection) {
        if (element is Int || element is Double) {
            product *= element as Int
        }
    }

    return Pair(intersection, product)
}