/**
 * Calculate the mean salary for a specific position in an economist company.
 *
 * @param salariesList A list of salaries of all economists in the company.
 * @param position The position of the economists for which you want to calculate the mean salary.
 * @return The mean salary for the given position.
 *
 * Example:
 * calculateMeanSalary(listOf(50000, 60000, 55000, 45000, 65000, 50000), 2) returns 55000.0
 */
fun calculateMeanSalary(salariesList: List<Int>, position: Int): Double {

    // Filter the salaries list for the given position using the 'in' statement
    val filteredSalaries = salariesList.filter { it / 10000 == position }

    // Calculate the mean salary using a for loop and other functions
    var totalSalary = 0
    for (salary in filteredSalaries) {
        totalSalary += salary
    }
    val meanSalary = totalSalary.toDouble() / filteredSalaries.size

    return meanSalary
}
/**
 * Calculate the mean salary for a specific position in an economist company.
 *
 * @param salariesList A list of salaries of all economists in the company.
 * @param position The position of the economists for which you want to calculate the mean salary.
 * @return The mean salary for the given position.
 *
 * Example:
 * calculateMeanSalary(listOf(50000, 60000, 55000, 45000, 65000, 50000), 2) returns 55000.0
 */
fun calculateMeanSalary(salariesList: List<Int>, position: Int): Double {
/**
 * Calculate the mean salary for a specific position in an economist company.
 *
 * @param salariesList A list of salaries of all economists in the company.
 * @param position The position of the economists for which you want to calculate the mean salary.
 * @return The mean salary for the given position.
 *
 * Example:
 * calculateMeanSalary(listOf(50000, 60000, 55000, 45000, 65000, 50000), 2) returns 55000.0
 */
fun calculateMeanSalary(salariesList: List<Int>, position: Int): Double {

    // Filter the salaries list for the given position using the 'in' statement
    val filteredSalaries = salariesList.filter { it / 10000 == position }

    // Calculate the mean salary using a for loop and other functions
    var totalSalary = 0
    for (salary in filteredSalaries) {
        totalSalary += salary
    }
    val meanSalary = totalSalary.toDouble() / filteredSalaries.size

    return meanSalary
}