/**
 * This exercise focuses on looping through tuples and tuple unpacking.
 *
 * Given two tuples, t1 and t2, complete the code to perform the following tasks:
 * 1. Loop through each element in t1 and print its value.
 * 2. Iterate through the elements of t2 and print the value along with its index.
 * 3. Unpack the first two elements of t1 and store them in variables a and b.
 * 4. Calculate the sum of all elements in t2 and return it.
 *
 * @param t1 Tuple with elements to loop through.
 * @param t2 Tuple with elements to sum.
 * @return The sum of all elements in t2.
 */
fun unpackTupleValues(t1: List<Any>, t2: List<Int>): Int {

    // Loop through each element in t1 and print its value
    for (element in t1) {
        println("Value in t1: $element")
    }

    // Iterate through the elements of t2 and print the value along with its index
    t2.forEachIndexed { index, value ->
        println("Index: $index, Value in t2: $value")
    }

    // Unpack the first two elements of t1
    val (a, b) = t1.take(2)

    // Calculate the sum of all elements in t2 and return it
    return t2.sum()
}
/**
 * This exercise focuses on looping through tuples and tuple unpacking.
 *
 * Given two tuples, t1 and t2, complete the code to perform the following tasks:
 * 1. Loop through each element in t1 and print its value.
 * 2. Iterate through the elements of t2 and print the value along with its index.
 * 3. Unpack the first two elements of t1 and store them in variables a and b.
 * 4. Calculate the sum of all elements in t2 and return it.
 *
 * @param t1 Tuple with elements to loop through.
 * @param t2 Tuple with elements to sum.
 * @return The sum of all elements in t2.
 */
fun unpackTupleValues(t1: List<Any>, t2: List<Int>): Int {
/**
 * This exercise focuses on looping through tuples and tuple unpacking.
 *
 * Given two tuples, t1 and t2, complete the code to perform the following tasks:
 * 1. Loop through each element in t1 and print its value.
 * 2. Iterate through the elements of t2 and print the value along with its index.
 * 3. Unpack the first two elements of t1 and store them in variables a and b.
 * 4. Calculate the sum of all elements in t2 and return it.
 *
 * @param t1 Tuple with elements to loop through.
 * @param t2 Tuple with elements to sum.
 * @return The sum of all elements in t2.
 */
fun unpackTupleValues(t1: List<Any>, t2: List<Int>): Int {

    // Loop through each element in t1 and print its value
    for (element in t1) {
        println("Value in t1: $element")
    }

    // Iterate through the elements of t2 and print the value along with its index
    t2.forEachIndexed { index, value ->
        println("Index: $index, Value in t2: $value")
    }

    // Unpack the first two elements of t1
    val (a, b) = t1.take(2)

    // Calculate the sum of all elements in t2 and return it
    return t2.sum()
}