Like jonrsharpe wrote, return count and total / count is equivalent to return total / count if count != 0 else count.
Why does it work?
The reason why they are equivalent is because the and operator evaluates the first statement, which here is count, and only if this expression is not false, it evaluates the statement on the right. So everything else will only see the value of the statement on the right.
But it's important to note that if the statement on the left is false, the value of the left statement is returned. So in 0 and total / count, 0 is returned. And in False and total / count, False is returned instead.
The expression can also be a function, which implies that in something like file.write('spam') and file.flush(), one of these functions might not be executed; if the file.write() call fails, and will not run the second expression and file.flush() won't be called, hence the file won't be flushed.
So, this expression could have drastic effects when writing to a database for example. It might not be clear to some people that an 'if' 'else' statement was the intention. In those cases, consider using an 'if' 'else' statement instead.
return total / count if count != 0 else count- see docs.python.org/3/library/stdtypes.html#truth-value-testing