In Python non-empty strings also evaluate as True
:
>>> bool('foo')
True
>>> bool('')
False
So no matter what your time_remaining
function returns, it will always be evaluated as True
in your if
statement.
You probably want to use something like:
time_remaining() == True
Or perhaps even have time_remaining
return False
or None
if there is no time left (especially if you are only going to use the output of time_remaining
in your if
statement).