Python callable() FunctionPython Functions


The callable() method returns True if the object appears callable, otherwise, it returns False.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

print(callable(10))

def add(a, b):
    return a + b
y=add(3,4)
print(y)
print(callable(add))
print(callable(y))

Output:

False
7
True
False

Syntax

callable(object)

Parameters

object — a single argument object.

Return Value

It returns True or False.

© 2021 Programtips.org, all rights reserved. Privacy Policy | Contact Us