def test_fun(elem, lis=[]):
if elem=='e':
lis.clear()
lis.append(elem)
return lis
print(test_fun('a'))#['a']
print(test_fun('b'))#lis Has been modified by the last call , return ['a', 'b']
print(test_fun('c',lis=[]))# Created a new lis, return ['c']
print(test_fun('d'))# This time lis It is the same as the previous two calls lis, Therefore return ['a', 'b', 'd']
print(test_fun('e'))#lis In situ emptying , return ['e']
print(test_fun('f'))# Then use the... After the last emptying lis, return ['e', 'f']