'TypeError :List' object is not callable


It giving such error like - ‘list’ object is not callable
code :=
my_list = (1, 5, 4, 6, 8, 11, 3, 12)
new_list = list(filter(lambda x: x%2 == 0 , my_list))
print(new_list)

but using set its working.
my_list = (1, 5, 4, 6, 8, 11, 3, 12)
new_list = set(filter(lambda x: x%2 == 0 , my_list))
print(new_list)

Does that notebook, at some point, assign list to actually be a list?

3 Likes

I get the same issue of ‘list’ object not being callable. I have very similar code, and it works in VSCode but not Jupyter Notebooks for some reason. Responding so I can see if someone else gets the answer.

You’d have to provide examples and details for anyone here to be able to offer clues. Plus, you should compare to Python outside of Jupyter, or is that what you mean by ‘in VSCode’? I’m assuming Python since you say you have very similar code; however, specifying is important as Jupyter can run code from a lot a lot languages.
Ideally your example would be be a minimal reproducible example. Likely looking into making that or sorting out which versions of Python are being used where, you’ll find the issue. Importantly, this is likely not a Jupyter issue and not pertinent to this site.

Please read Getting good answers to your questions and let that guide inform you how to better improve your posts.