Try to change the parenthesis position so that the rounding happens before the division by 2
def round_of_rating(number):
"""Round a number to the closest half integer.
>>> round_of_rating(1.3)
1.5
>>> round_of_rating(2.6)
2.5
>>> round_of_rating(3.0)
3.0
>>> round_of_rating(4.1)
4.0"""
return round(number * 2) / 2
Edit: Added a doctestable docstring:
>>> import doctest
>>> doctest.testmod()
TestResults(failed=0, attempted=4)