/**
 * The goal of this exercise is to update the grades of the students based on a given threshold.
 *
 * @param studentsGrades A list of pairs representing the students' names and their respective grades.
 * @param gradeThreshold The minimum grade threshold required for updating the grades.
 * @return A modified list of pairs with the updated grades.
 */
fun updateStudentsGrades(studentsGrades: MutableList<Pair<String, Int>>, gradeThreshold: Int): MutableList<Pair<String, Int>> {

    var i = 0  // Loop counter

    while (i < studentsGrades.size) {  // Checking if loop index is within the range of the list
        if (studentsGrades[i].second >= gradeThreshold) {  // Checking if the student's grade is above or equal to the threshold
            studentsGrades[i] = Pair(studentsGrades[i].first, 100)  // Updating the student's grade to 100
        }
        i++  // Incrementing the loop counter
    }

    return studentsGrades
}

// Exercise – Update students' grades based on a threshold
val studentsList = mutableListOf(Pair("John", 78), Pair("Alice", 92), Pair("Bob", 85), Pair("Claire", 62), Pair("David", 100))
/**
 * The goal of this exercise is to update the grades of the students based on a given threshold.
 *
 * @param studentsGrades A list of pairs representing the students' names and their respective grades.
 * @param gradeThreshold The minimum grade threshold required for updating the grades.
 * @return A modified list of pairs with the updated grades.
 */
fun updateStudentsGrades(studentsGrades: MutableList<Pair<String, Int>>, gradeThreshold: Int): MutableList<Pair<String, Int>> {
/**
 * The goal of this exercise is to update the grades of the students based on a given threshold.
 *
 * @param studentsGrades A list of pairs representing the students' names and their respective grades.
 * @param gradeThreshold The minimum grade threshold required for updating the grades.
 * @return A modified list of pairs with the updated grades.
 */
fun updateStudentsGrades(studentsGrades: MutableList<Pair<String, Int>>, gradeThreshold: Int): MutableList<Pair<String, Int>> {

    var i = 0  // Loop counter

    while (i < studentsGrades.size) {  // Checking if loop index is within the range of the list
        if (studentsGrades[i].second >= gradeThreshold) {  // Checking if the student's grade is above or equal to the threshold
            studentsGrades[i] = Pair(studentsGrades[i].first, 100)  // Updating the student's grade to 100
        }
        i++  // Incrementing the loop counter
    }

    return studentsGrades
}

// Exercise – Update students' grades based on a threshold
val studentsList = mutableListOf(Pair("John", 78), Pair("Alice", 92), Pair("Bob", 85), Pair("Claire", 62), Pair("David", 100))