Python/error debug

TypeError:

kimble2 2024. 8. 17. 11:23
반응형

 

Calling a Non-Callable Object

Problematic Code:

number = 10
result = number()
 

Error Message:

TypeError: 'int' object is not callable
 

Solution: Here, number is an integer (int), so it cannot be called like a function. If you intended to use the variable, remove the parentheses.

 

result = number
 

Alternatively, if you intended to call a function, ensure you are using the correct function.

 

def number():
    return 10

result = number()
 
 

 

 

반응형