hemanth reddy
hemanth reddy

Reputation: 1

SyntaxError: invalid syntax [in python code]

code is:

cat_list = [k for k, v in cat_counter.()[:50]]

Error is as follows:

File "", line 1 cat_list = [k for k, v in cat_counter.()[:50]]

SyntaxError: invalid syntax

Upvotes: 0

Views: 892

Answers (1)

yash
yash

Reputation: 29

The cat_counter function would be defined like this:

def cat_counter():
    # Make function 

Thus, simply remove the dot to properly call the function:

cat_list = [k for k, v in cat_counter()[:50]]

Upvotes: 1

Related Questions