/**
 * This exercise requires writing a function that takes two sequences as input and returns a list containing the elements that are common to both sequences.
 * The function should iterate over the first sequence and check if each element appears in the second sequence. If an element appears in both sequences, it should be added to the result list.
 * This exercise requires using indexing and looping over sequences.
 *
 * @param sequence1 A sequence (list, tuple, string) containing elements to be compared.
 * @param sequence2 A sequence (list, tuple, string) containing elements to be compared.
 * @return A list containing the elements that are common to both sequences.
 *
 * Example:
 * getIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) => [3, 4]
 */
fun getIntersection(sequence1: List<Any>, sequence2: List<Any>): List<Any> {

    val intersection = mutableListOf<Any>()
    for (element in sequence1) {
        if (element in sequence2) {
            intersection.add(element)
        }
    }
    return intersection
}
/**
 * This exercise requires writing a function that takes two sequences as input and returns a list containing the elements that are common to both sequences.
 * The function should iterate over the first sequence and check if each element appears in the second sequence. If an element appears in both sequences, it should be added to the result list.
 * This exercise requires using indexing and looping over sequences.
 *
 * @param sequence1 A sequence (list, tuple, string) containing elements to be compared.
 * @param sequence2 A sequence (list, tuple, string) containing elements to be compared.
 * @return A list containing the elements that are common to both sequences.
 *
 * Example:
 * getIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) => [3, 4]
 */
fun getIntersection(sequence1: List<Any>, sequence2: List<Any>): List<Any> {
/**
 * This exercise requires writing a function that takes two sequences as input and returns a list containing the elements that are common to both sequences.
 * The function should iterate over the first sequence and check if each element appears in the second sequence. If an element appears in both sequences, it should be added to the result list.
 * This exercise requires using indexing and looping over sequences.
 *
 * @param sequence1 A sequence (list, tuple, string) containing elements to be compared.
 * @param sequence2 A sequence (list, tuple, string) containing elements to be compared.
 * @return A list containing the elements that are common to both sequences.
 *
 * Example:
 * getIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) => [3, 4]
 */
fun getIntersection(sequence1: List<Any>, sequence2: List<Any>): List<Any> {

    val intersection = mutableListOf<Any>()
    for (element in sequence1) {
        if (element in sequence2) {
            intersection.add(element)
        }
    }
    return intersection
}