/**
 * This exercise requires the economist to find the intersection of two tuples using the is operator.
 *
 * The function takes two tuples as arguments and returns a new tuple containing the elements that are common to both tuples.
 *
 * Example:
 * intersectTuples(listOf('a', 'b', 'c'), listOf('b', 'c', 'd')) -> listOf('b', 'c')
 */
fun intersectTuples(tup1: List<Any>, tup2: List<Any>): List<Any> {

    // Initialize an empty list to store the intersecting elements
    val intersection = mutableListOf<Any>()

    // Iterate over each element in the first tuple
    for (element in tup1) {
        // Check if the element exists in the second tuple using the 'in' operator
        if (element in tup2 && element !in intersection) {
            // If the element is found and not already in the intersection list, add it to the intersection list
            intersection.add(element)
        }
    }

    // Return the final intersection list
    return intersection
}
/**
 * This exercise requires the economist to find the intersection of two tuples using the is operator.
 *
 * The function takes two tuples as arguments and returns a new tuple containing the elements that are common to both tuples.
 *
 * Example:
 * intersectTuples(listOf('a', 'b', 'c'), listOf('b', 'c', 'd')) -> listOf('b', 'c')
 */
fun intersectTuples(tup1: List<Any>, tup2: List<Any>): List<Any> {
/**
 * This exercise requires the economist to find the intersection of two tuples using the is operator.
 *
 * The function takes two tuples as arguments and returns a new tuple containing the elements that are common to both tuples.
 *
 * Example:
 * intersectTuples(listOf('a', 'b', 'c'), listOf('b', 'c', 'd')) -> listOf('b', 'c')
 */
fun intersectTuples(tup1: List<Any>, tup2: List<Any>): List<Any> {

    // Initialize an empty list to store the intersecting elements
    val intersection = mutableListOf<Any>()

    // Iterate over each element in the first tuple
    for (element in tup1) {
        // Check if the element exists in the second tuple using the 'in' operator
        if (element in tup2 && element !in intersection) {
            // If the element is found and not already in the intersection list, add it to the intersection list
            intersection.add(element)
        }
    }

    // Return the final intersection list
    return intersection
}