For accessing the elements of a list you need to use the square brackets ([]
) and not the parenthesis (()
).
Instead of:
print wordlists(len(words))
you need to use:
print worldlists[len(words)]
And instead of:
(wordlists(len(words))).append(words)
you need to use:
worldlists[len(words)].append(words)