how would I go about preventing an action done in a function from resetting? for example:
def fun(list_1, list_2):
list_2 = list(list_1)
print(list_2)
return list_2
if __name__ == '__main__':
list_1 = [[1, 2, 3], [4, 5, 6]]
list_2 = []
fun(list_1, list_2)
print(list_1)
print(list_2)
print("Done")
I would like to be able to access the value of list_2 after exiting the function but it keeps resetting it. Is there a way to go about doing that because I'm restricted from using global on a project I'm working on? Thanks and have a great day.