Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Transform a string in a List

leonardo_13 (1540 points)
6 15 22
in Exam exercises by (1.5k points)
reshown by
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)
228 views
closed

2 Answers

Best answer
SaverioPas (710 points)
1 4 6
by (710 points)
selected by
I've just tried it and it works for me...
SaverioPas (710 points)
1 4 6
by (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 15 22
by (1.5k points)
I'll try to uninstall and install again Spyder
angelo.spognardi (8170 points)
75 155 224
by (8.2k points)
You've likely defined a variable called list, hiding the original list function.

A.
leonardo_13 (1540 points)
6 15 22
by (1.5k points)
thank you professor