/**
 * This exercise aims to test your understanding of for loops and iterating over a list.
 * You need to complete the code in order to find the intersection of two lists, list1 and list2.
 * The intersection of two lists is a new list that contains the common elements between them.
 *
 * @param list1 The first list to find the intersection.
 * @param list2 The second list to find the intersection.
 * @return A list containing the common elements between list1 and list2.
 */
fun intersectionOfForLoopAndIteratingOverList(list1: List<Any>, list2: List<Any>): List<Any> {

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

    // Iterate over each element in list1
    for (item1 in list1) {
        // Iterate over each element in list2
        for (item2 in list2) {
            // Check if item1 and item2 are the same
            if (item1 == item2) {
                // Add the common element to the intersection list
                intersection.add(item1)
            }
        }
    }

    return intersection
}
/**
 * This exercise aims to test your understanding of for loops and iterating over a list.
 * You need to complete the code in order to find the intersection of two lists, list1 and list2.
 * The intersection of two lists is a new list that contains the common elements between them.
 *
 * @param list1 The first list to find the intersection.
 * @param list2 The second list to find the intersection.
 * @return A list containing the common elements between list1 and list2.
 */
fun intersectionOfForLoopAndIteratingOverList(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * This exercise aims to test your understanding of for loops and iterating over a list.
 * You need to complete the code in order to find the intersection of two lists, list1 and list2.
 * The intersection of two lists is a new list that contains the common elements between them.
 *
 * @param list1 The first list to find the intersection.
 * @param list2 The second list to find the intersection.
 * @return A list containing the common elements between list1 and list2.
 */
fun intersectionOfForLoopAndIteratingOverList(list1: List<Any>, list2: List<Any>): List<Any> {

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

    // Iterate over each element in list1
    for (item1 in list1) {
        // Iterate over each element in list2
        for (item2 in list2) {
            // Check if item1 and item2 are the same
            if (item1 == item2) {
                // Add the common element to the intersection list
                intersection.add(item1)
            }
        }
    }

    return intersection
}