/**
 * This exercise aims to test the historian's ability to access elements in a list while executing nested loops.
 *
 * Given two lists, list1 and list2, the task is to iterate over both lists using nested loops and
 * access each element in the process. The goal is to print the square of each number in list1
 * and the cube of each number in list2.
 *
 * Example:
 * Given list1 = [1, 2, 3] and list2 = [4, 5, 6], the expected output is:
 * 1^2 = 1
 * 2^2 = 4
 * 3^2 = 9
 * 4^3 = 64
 * 5^3 = 125
 * 6^3 = 216
 *
 * Your task is to complete the code below to produce the expected output.
 */
fun accessElementsNestedLoops(list1: List<Int>, list2: List<Int>) {

    for (num1 in list1) {
        for (num2 in list2) {
            // Square the number in list1 and print the result
            println("$num1^2 = ${num1 * num1}")
            // Cube the number in list2 and print the result
            println("$num2^3 = ${num2 * num2 * num2}")
        }
    }
}
/**
 * This exercise aims to test the historian's ability to access elements in a list while executing nested loops.
 *
 * Given two lists, list1 and list2, the task is to iterate over both lists using nested loops and
 * access each element in the process. The goal is to print the square of each number in list1
 * and the cube of each number in list2.
 *
 * Example:
 * Given list1 = [1, 2, 3] and list2 = [4, 5, 6], the expected output is:
 * 1^2 = 1
 * 2^2 = 4
 * 3^2 = 9
 * 4^3 = 64
 * 5^3 = 125
 * 6^3 = 216
 *
 * Your task is to complete the code below to produce the expected output.
 */
fun accessElementsNestedLoops(list1: List<Int>, list2: List<Int>) {
/**
 * This exercise aims to test the historian's ability to access elements in a list while executing nested loops.
 *
 * Given two lists, list1 and list2, the task is to iterate over both lists using nested loops and
 * access each element in the process. The goal is to print the square of each number in list1
 * and the cube of each number in list2.
 *
 * Example:
 * Given list1 = [1, 2, 3] and list2 = [4, 5, 6], the expected output is:
 * 1^2 = 1
 * 2^2 = 4
 * 3^2 = 9
 * 4^3 = 64
 * 5^3 = 125
 * 6^3 = 216
 *
 * Your task is to complete the code below to produce the expected output.
 */
fun accessElementsNestedLoops(list1: List<Int>, list2: List<Int>) {

    for (num1 in list1) {
        for (num2 in list2) {
            // Square the number in list1 and print the result
            println("$num1^2 = ${num1 * num1}")
            // Cube the number in list2 and print the result
            println("$num2^3 = ${num2 * num2 * num2}")
        }
    }
}