The first time I run this block of code from Notebook it works fine:
#Which letters and how many
letters = ["a","b","c"]
noOfLetters = len(letters)
#Looking for all permutations
resultA = []
from itertools import permutations
for i in range(noOfLetters):
resultA.append(list(permutations(letters,i+1)))
If I run it again (without restarting the Kernel) I get the following error:
TypeError Traceback (most recent call last)
<ipython-input-5-4050a4ce7a36> in <module>()
7 from itertools import permutations
8 for i in range(noOfLetters):
----> 9 resultA.append(list(permutations(letters,i+1)))
TypeError: 'list' object is not callable
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…