/**
 * Given two tuples containing musician performance scores,
 * compare each score pair and perform floating-point arithmetic operations.
 *
 * The tuples should have the same length and corresponding elements
 * should represent scores for the same performance metric.
 *
 * Return the sum of absolute differences between the corresponding scores in the tuples.
 *
 * Example:
 * compareAndCalculate(listOf(4.8, 9.2, 7.5, 6.1), listOf(8.4, 6.2, 5.9, 7.8))
 * Output: 13.0
 */
fun compareAndCalculate(a: List<Double>, b: List<Double>): Double {

    // Checking if the tuples have the same length
    if (a.size != b.size) {
        return "Error: Tuples must have the same length.".toDouble()
    }

    var totalDiff = 0.0

    // Comparing and calculating absolute differences
    for (i in a.indices) {
        val diff = Math.abs(a[i] - b[i])
        totalDiff += diff
    }

    return totalDiff
}
/**
 * Given two tuples containing musician performance scores,
 * compare each score pair and perform floating-point arithmetic operations.
 *
 * The tuples should have the same length and corresponding elements
 * should represent scores for the same performance metric.
 *
 * Return the sum of absolute differences between the corresponding scores in the tuples.
 *
 * Example:
 * compareAndCalculate(listOf(4.8, 9.2, 7.5, 6.1), listOf(8.4, 6.2, 5.9, 7.8))
 * Output: 13.0
 */
fun compareAndCalculate(a: List<Double>, b: List<Double>): Double {
/**
 * Given two tuples containing musician performance scores,
 * compare each score pair and perform floating-point arithmetic operations.
 *
 * The tuples should have the same length and corresponding elements
 * should represent scores for the same performance metric.
 *
 * Return the sum of absolute differences between the corresponding scores in the tuples.
 *
 * Example:
 * compareAndCalculate(listOf(4.8, 9.2, 7.5, 6.1), listOf(8.4, 6.2, 5.9, 7.8))
 * Output: 13.0
 */
fun compareAndCalculate(a: List<Double>, b: List<Double>): Double {

    // Checking if the tuples have the same length
    if (a.size != b.size) {
        return "Error: Tuples must have the same length.".toDouble()
    }

    var totalDiff = 0.0

    // Comparing and calculating absolute differences
    for (i in a.indices) {
        val diff = Math.abs(a[i] - b[i])
        totalDiff += diff
    }

    return totalDiff
}