11.9 C
New York
Wednesday, November 22, 2023

TypeError ‘tuple’ object is not callable

In this article, we will learn about an error called “TypeError ‘tuple’ object is not callable”. This error is raised when we try to call a tuple object. But the tuple objects are not callable Thus the error is raised. It may also be due to the syntax error.

Let’s understand this more briefly with the help of an example

# Declare a tuple with name "mytuple"
mytuple = ('Red','Green','White')

printtuple = mytuple('Orange','Blue','Green')


  File "pyprogram.py", line 2, in <module>
    printtuple = mytuple('Orange','Blue','Green')
TypeError: 'tuple' object is not callable

In the above example, we at first created a tuple with the name “MyTuple“. And in the next line of the code, we called tuple object “MyTuple” as function MyTuple(‘Orange’,’Blue’,’Green’) 

But we know that the tuples are uncallable, thus the line generates the TypeError.

printtuple = mytuple('Orange','Blue','Green')

TypeError 'tuple' object is not callable


mytuple = ('Red','Green','While')
mytuple2 = ('Orange','Blue','Green')


('Red', 'Green', 'While')                                                                                             
('Orange', 'Blue', 'Green')


In the above solution, we created two tuples ‘MyTuple’ and ‘MyTuple2’. 
They both have individual elements such as ‘Red’, ‘Green’, and ‘Orange’.
When the print() method is used for displaying the elements of the tuples, the output we get is

(‘Red’, ‘Green’, ‘While’)
(‘Orange’, ‘Blue’, ‘Green’)

Here, the TypeError: ‘tuple’ object is not callable is avoided. This is because the tuples are not called as functions as in the previous instance.


In this article we learned about the error “TypeError: ‘tuple’ object is not callable”. This TypeError is generated when we try to access the tuple as a function. But since we know tuple is not callable thus the error is raised.  

Related Articles

Latest Articles