Transform a string in a List

leonardo_13 (1540 points)
6 14 22
asked Feb 3 in Exam exercises by leonardo_13 (1,540 points)
reshown Feb 4 by leonardo_13
Why if I write these lines of code it give me back "TypeError: 'dict_items' object is not callable" and not " ['w', 'o', 'r', 'd'] " ?

If I use python directly on the prompt it works.

word = "word"
list_of_letters = list(word)
print(list_of_letters)
95 views

2 Answers

Best answer
SaverioPas (710 points)
1 4 6
answered Feb 3 by SaverioPas (710 points)
selected Feb 4 by leonardo_13
I've just tried it and it works for me...
SaverioPas (710 points)
1 4 6
commented Feb 3 by SaverioPas (710 points)
Maybe the problem is not in those lines, it says "dict_items", so there should be a dictionary somewhere that you called instead of a string
leonardo_13 (1540 points)
6 14 22
commented Feb 3 by leonardo_13 (1,540 points)
I'll try to uninstall and install again Spyder
angelo.spognardi (4680 points)
37 63 96
answered Feb 3 by angelo.spognardi (4,680 points)
You've likely defined a variable called list, hiding the original list function.

A.
leonardo_13 (1540 points)
6 14 22
commented Feb 4 by leonardo_13 (1,540 points)
thank you professor