I'm trying to round off floating digits to the nearest 0.5
For eg.
1.3 -> 1.5
2.6 -> 2.5
3.0 -> 3.0
4.1 -> 4.0
This is what I'm doing
def round_of_rating(number):
return round((number * 2) / 2)
This rounds of numbers to closest integer. What would be the correct way to do this?