• + 0 comments
     var result: Array<Int> = Array<Int>(grades.size) { 0 }
        var counter = 0
        for(grade: Int in grades) {
            if (grade < 38) {
                result[counter] = grade
                counter++
            } else {
                if(grade % 10 in (3..4) || grade % 10 in (8..9)) {
                    result[counter] = grade - grade % 5 + 5
                    counter++
                } else {
                    result[counter] = grade
                    counter++
                }
            }
        }
        return result