Python Error "typeerror: Nonetype Object Not Callable"
Solution 1:
A function can have only a single set of arguments.
print_statement = "you have" + str(time) + "seconds left"print(print_statement)
The above code should work.
Solution 2:
You are using the wrong syntax for the print
function. Please note that print
in python-3 is a callable. So when you call it, you can pass all that you need to be printed as parameters.
Hence
print ("you have", time, "seconds left")
is the correct syntax. You can optionally also specify a separator.
For posterity, TypeError: 'NoneType' object is not callable
is an error thrown when you try to use an NoneType
object as a callable. Python flagged out when it discovered that you had tried to pass time
(an object) to print ("you have")
which returns a NoneType
object.
Remember, in python-3print
is a callable and it essentially returns a NullType
object (which is nothing at all for that matter, and hence not callable).
Post a Comment for "Python Error "typeerror: Nonetype Object Not Callable""