TypeError: unorderable types: function() < int()
Ben Finney
ben+python at benfinney.id.au
Tue May 10 05:16:48 EDT 2016
George Molsom <georgieelize00 at gmail.com> writes:
> I have created a program in class 'make a game that tests how good
> people are at guessing when 10 seconds has elapsed.'
Welcome! You may want to join the dedicated beginners forum
<URL:https://mail.python.org/mailman/listinfo/tutor> where we
collaboratively teach foundational Python concepts.
> Traceback (most recent call last):
> File "E:/Computing/Python/Little book of challenges/Challenge 6 10 seconds experiment.py", line 20, in <module>
> if totaltime < 10:
> TypeError: unorderable types: function() < int()
That's right. The ‘totaltime’ name refers to a function. To ask whether
an integer object is less than a function object is not a meaningful
comparison.
If you want to *call* the function, use the “call this function”
syntax::
totaltime()
That will evaluate to the return value when you call it, so use the
return value::
if totaltime() < 10:
# …
--
\ “There's a certain part of the contented majority who love |
`\ anybody who is worth a billion dollars.” —John Kenneth |
_o__) Galbraith, 1992-05-23 |
Ben Finney
More information about the Python-list
mailing list