You are viewing a single comment's thread. Return to all comments →
awesome use of the modulo operation
this solution is mathematically cool man
Could be condensed to a single condition if you wanted.
if grade >= 38:
if grade % 5 > 2:
grade += 5 - (grade % 5)
That's two, and it could be condensed to none if you wanted.
print((grade, grade - (grade % -5))[grade >= 38 and grade % 5 > 2])