Here is my solution to Grading Students courtesy of HackerRank. My code passes all tests in the testing suite but I feel like there could be a better implementation of it. But nonetheless, what are some pros/cons of my current implementation? Thank you for answering.
def gradingStudents(grades): rounded_grades =  for grade in grades: if grade < 38: rounded_grades.append(grade) else: if grade % 5 == 0: rounded_grades.append(grade) else: difference = 0 new_grade = grade while grade % 5 != 0: difference += 1 new_grade += 1 if new_grade % 5 == 0: break if difference < 3: rounded_grades.append(new_grade) else: rounded_grades.append(grade) return rounded_grades