/**
 * This function calculates the grade of a carpenter based on the dimensions and materials used.
 * The grade is calculated by assigning points to each material and dimensions and then dividing the
 * total score by the number of materials used.
 *
 * @param dimensions A nested list containing the dimensions of the project.
 * @param materials A list of strings representing the materials used in the project.
 * @return The grade of the carpenter.
 */
fun calculateCarpenterGrade(dimensions: List<List<Int>>, materials: List<String>): Float {

    // Assigning points to each material
    val materialPoints = mapOf(
        "wood" to 5,
        "metal" to 8,
        "plastic" to 3,
        "glass" to 7,
        "concrete" to 6
    )

    // Initializing the total score
    var totalScore = 0

    // Calculating the total score
    for (row in dimensions) {
        for (dim in row) {
            totalScore += dim
        }
    }

    // Dividing the total score by the number of materials used
    val grade = totalScore / materials.size.toFloat()

    return grade
}

// Uncomment the lines below and fill in the missing information to solve the exercise:

// val dimensions = listOf(
/**
 * This function calculates the grade of a carpenter based on the dimensions and materials used.
 * The grade is calculated by assigning points to each material and dimensions and then dividing the
 * total score by the number of materials used.
 *
 * @param dimensions A nested list containing the dimensions of the project.
 * @param materials A list of strings representing the materials used in the project.
 * @return The grade of the carpenter.
 */
fun calculateCarpenterGrade(dimensions: List<List<Int>>, materials: List<String>): Float {
/**
 * This function calculates the grade of a carpenter based on the dimensions and materials used.
 * The grade is calculated by assigning points to each material and dimensions and then dividing the
 * total score by the number of materials used.
 *
 * @param dimensions A nested list containing the dimensions of the project.
 * @param materials A list of strings representing the materials used in the project.
 * @return The grade of the carpenter.
 */
fun calculateCarpenterGrade(dimensions: List<List<Int>>, materials: List<String>): Float {

    // Assigning points to each material
    val materialPoints = mapOf(
        "wood" to 5,
        "metal" to 8,
        "plastic" to 3,
        "glass" to 7,
        "concrete" to 6
    )

    // Initializing the total score
    var totalScore = 0

    // Calculating the total score
    for (row in dimensions) {
        for (dim in row) {
            totalScore += dim
        }
    }

    // Dividing the total score by the number of materials used
    val grade = totalScore / materials.size.toFloat()

    return grade
}

// Uncomment the lines below and fill in the missing information to solve the exercise:

// val dimensions = listOf(