I don't understand why do the test1 and test2 will return 2 different output when they are the same.
python3.7.4
fin=open('D:\Python\Think Python\words.txt')
def build_list_append(file):
word_list=[]
for line in fin:
word=line.strip()
word_list.append(word)
return word_list
def test1(worklist1=build_list_append(fin)):
print("This is test1,It will return a non-empty list")
print(len(worklist1))
def test2(worklist2=build_list_append(fin)):
print("This is test2,It will return an empty list")
print(len(worklist2))