I have a function that appears to be saving the variable when I use
list.append. When I print each increment, the list changes. When I print the full list of lists, every element is the same (the last instance of the variable list). How can I force the master list to save the previous instances?
The base function just converts the list from base-10 to a new base (base-4 in my example)
list1 = ["v", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"] def combo(object_list, spots): pool = len(object_list) total = pool**spots permlist = list() wordlist = list() z =  for i in range(total): print("top", wordlist) wordlist.clear() z = base(i,pool,spots) for q in z: j=-1 for a in object_list: j+=1 if int(q) == int(j): wordlist.append(a) permlist.append(wordlist) return permlist def base(number, base, digits): remainder =  result = [0,0] while number >0: dividend = number // int(base) remainder.append(str(number % int(base))) number = dividend result = list(reversed(remainder)) while len(result) < digits: result.insert(0,0) return result print (combo(list1,4))
wordlist =