Ответ 1
Попробуйте изменить положение скобки, чтобы округление происходило до деления на 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
Изменить: добавлена doctest
способная docstring:
>>> import doctest
>>> doctest.testmod()
TestResults(failed=0, attempted=4)