It looks like you work mainly with list1 and list2 inside a loop. Therefore, you can simply reassign their values:
list1 = list2 list2 = [0]*len(list2)
Python also allows you to shorten this to a single line:
list1, list2 = list2, [0]*len(list2)
but in this case, I think the two-line version is more readable. Or, if you really want list_of_lists , then:
list_of_lists = [list2, [0]*len(list2)]
or if you want:
list1, list2 = list_of_lists = [list2, [0]*len(list2)]
source share