if we replace the outside list from None to []... then append it inside function, should work the same. no parameters,return or global keywords needed. list id also preserved. jz repeat the same for test2() and test3(). did this in python 2.7 just in case error occured
list = [] def test(): for a in range(1,6): list.append(a) test()
Output:list = [1,2,3,4,5]
swallow osama bin laden