/**
 * Write a function that takes two lists of floating-point numbers as input and finds the intersection of the two lists.
 * The intersection should contain only numbers that are present in both lists.
 *
 * @param nums1 A list of floating-point numbers.
 * @param nums2 Another list of floating-point numbers.
 * @return A list containing the numbers that are common to both input lists.
 *
 * Example:
 * findIntersection(listOf(1.5, 2.3, 4.7, 3.1), listOf(2.3, 6.2, 1.5, 8.9)) // [1.5, 2.3]
 * findIntersection(listOf(3.4, 5.6, 7.8), listOf(1.2, 9.0, 5.6)) // [5.6]
 */
fun findIntersection(nums1: List<Double>, nums2: List<Double>): List<Double> {

    val intersection = mutableListOf<Double>()
    
    for (num in nums1) {
        if (num in nums2) {
            intersection.add(num)
        }
    }
    
    return intersection
}
/**
 * Write a function that takes two lists of floating-point numbers as input and finds the intersection of the two lists.
 * The intersection should contain only numbers that are present in both lists.
 *
 * @param nums1 A list of floating-point numbers.
 * @param nums2 Another list of floating-point numbers.
 * @return A list containing the numbers that are common to both input lists.
 *
 * Example:
 * findIntersection(listOf(1.5, 2.3, 4.7, 3.1), listOf(2.3, 6.2, 1.5, 8.9)) // [1.5, 2.3]
 * findIntersection(listOf(3.4, 5.6, 7.8), listOf(1.2, 9.0, 5.6)) // [5.6]
 */
fun findIntersection(nums1: List<Double>, nums2: List<Double>): List<Double> {
/**
 * Write a function that takes two lists of floating-point numbers as input and finds the intersection of the two lists.
 * The intersection should contain only numbers that are present in both lists.
 *
 * @param nums1 A list of floating-point numbers.
 * @param nums2 Another list of floating-point numbers.
 * @return A list containing the numbers that are common to both input lists.
 *
 * Example:
 * findIntersection(listOf(1.5, 2.3, 4.7, 3.1), listOf(2.3, 6.2, 1.5, 8.9)) // [1.5, 2.3]
 * findIntersection(listOf(3.4, 5.6, 7.8), listOf(1.2, 9.0, 5.6)) // [5.6]
 */
fun findIntersection(nums1: List<Double>, nums2: List<Double>): List<Double> {

    val intersection = mutableListOf<Double>()
    
    for (num in nums1) {
        if (num in nums2) {
            intersection.add(num)
        }
    }
    
    return intersection
}