A Common-Sense Guide to Data Structures and Algorithms, Second Edition:

Book: A Common-Sense Guide to Data Structures and Algorithms, Second Edition
Page 320
Function: collectAllWords
Python Version: CPython version 3.10.0

@jaywengrow

In the statement def collectAllWords(self, node=None, word=“”, words=), words= means every time we call collectAllWords we use the same list. This means the list is not empty after the first call.

code:

explanation of why: