Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
3 views
in Python by (210 points)

When I executes my python program it shows the error

TypeError: 'list' object is not callable.

In these two lines

print  wordlists(len(words)) 
        (wordlists(len(words))).append(words) 

1 Answer

0 votes
by (119k points)

If the wordlists is a list, you cannot access the list using "( )" but use "[ ]" for accessing the elements of the list. So, replace those lines with the following code:

print worldlists[len(words)]

worldlists[len(words)].append(words)

IIf you want to become a pro in Python, you can check out this Python Course by Intellipaat that offers instructor-led training, hands-on assignments, and certification. 

Related questions

0 votes
1 answer
0 votes
1 answer
asked Aug 30, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
asked Sep 26, 2019 in Python by Sammy (47.6k points)
0 votes
0 answers
asked Jun 24, 2021 in Python by priyanka (120 points)

Browse Categories

...