Skip to content Skip to sidebar Skip to footer

Python Error "typeerror: Nonetype Object Not Callable"

I'm trying to make a simple timer script in python. I see a lot of other people have had this error too, but I think my error may be different because I'm new to python: time=60 fr

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 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 NoneTypeobject 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 NoneTypeobject.

Remember, in print is a callable and it essentially returns a NullTypeobject (which is nothing at all for that matter, and hence not callable).

Post a Comment for "Python Error "typeerror: Nonetype Object Not Callable""