- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
callable() in Python Program
In this tutorial, we are going to discuss the built-in method callable(). It takes one argument and returns whether the argument is callable or not. If you take any function or class, they are callable. Constants like integers, floats, strings, etc.., are not callable.
Let's see some examples.
# definition def even(n): return True if n % 2 == 0 else False # checking whether even() is callable or not print(callable(even))
If you run the above code, you will get the following results.
If you see, we can call the functions. So, the method callable() returns True. Let's see another example it returns False.
# initializing a number num = 7 # checking whether num is callable or not print(callable(num))
If you run the above program, you will get the following results.
We have got False for the integer value. Because we can't call the num like functions or classes. If you pass the class name to callable(), it will return True. Try it!
If you find any difficulty in understanding the tutorial, mention it in the comment section.
- callable() in Python
- Callable and Future in Java
- What is Callable interface in Java?
- Functools — Higher-order functions and operations on callable objects in Python
- Difference between Runnable and Callable interface in java
- How can we write Callable as a lambda expression in Java?
- How to call a stored procedure using callable statement in JDBC explain?
- Can we call functions using Callable Statements? Explain with an example in JDBC?
- bin() in Python program
- ascii() in Python program
- Calendar in Python Program
- bool() in Python Program
- Logging in Python Program
- Backward iteration in Python program
- Insertion Sort in Python Program