You are viewing a single comment's thread. Return to all comments →
Here is Python 3 solution from my HackerrankPractice repository:
for _ in range(int(input())):
grade = int(input())
if grade >= 38 and grade % 5 >= 3:
grade = (grade + 5) // 5 * 5
Feel free to ask if you have any questions :)
Why do you add 5 to grade?
The syntax highlighting is off. The '//' represents floor division in python.
They are adding five,
Then dividing by five (rounding down to the nearest whole number)
Then multiplying by five.