I have two lists (list_1,list_2) and a function which returns two lists (list_1_f, list_2_f) and I would like to add the items of list_1_f to list_1 and the items of list_2_f to list_2:
def lists():
list_1_f = [10,10,10]
list_2_f = [20,20,20]
return list_1_f,list_2_f
list_1, list_2 = [1,1,1], [2,2,2]
I always will have 2 original lists and the extension is going to be done just for another two extra lists, there is no other possibility. So that at the end I would have two lists with the original items plus the ones got from the function, and the output would be:
list_1 = [1,1,1,10,10,10]
list_2 = [2,2,2,20,20,20]
I have tried the following lines using extend function but none works:
list_1.extend([]), list_2.extend([]) = lists()
list_1.extend(), list_2.extend() = lists()
list_1.extend, list_2.extend = lists()
I could always do the following:
list_1a, list_2a = lists()
list_1.extend(list_1a)
list_2.extend(list_2a)
But I was wondering if it is even possible to make the extension without having to create two intermediate lists.