‘tuple’ object is not callable – Python Error


Python throws the error, ‘tuple’ object is not callable, when you forget to separate members using comma in single or multidimensional tuples.

Consider this example –

myTuple = (
    ("Captain America", "Shield")
    ("Ironman", "Suit")
    ("Thor", "Mjolnir")
    ("Hawkeye", "Bow-arrows")
    ("Spiderman", "Web Shooters")

# Error: 'tuple' object is not callable

This code will throw the tuple object not callable error because although we put commas in 2nd dimensional elements like ("Captain America", "Shield") we forgot to put one in 1st dimension like ("Captain America", "Shield") , ("Ironman", "Suit").

The correct way to write this code is –

myTuple = (
    ("Captain America", "Shield"),
    ("Ironman", "Suit"),
    ("Thor", "Mjolnir"),
    ("Hawkeye", "Bow-arrows"),
    ("Spiderman", "Web Shooters")


    Tweet this to help others

Live Demo

Demo might not work in private window (incognito)

Sign Up for Our Newsletters

Get only the best articles delivered to your mail

You May Also Like
python run bash script in background

python run bash script in background

Table of Contents Hide IntroductionTerminating background script after a timeoutHow to check if process is still running or terminated?How to get output from process?ConclusionLive DemoRelated Posts: Python subprocess library is…
View Post