I have an iteration process that after every iteration gives me a list, eg. a = [1,2,3,4]. Can I use this list as a key to a dictionary? The next iteration the same list changes elements, say after the 2nd iteration I have [2,1,3,4]. Can I construct a dictionary d = {[1,2,3,4]:"value1", [2,1,3,4]:"value2"]}
I tried doing it but python tells me I can't do it using a list. So I tried with a tuple but I can't get it to work.
trylist = (1,2,3,4)
dictionary = {}
d[trylist] = 'value'
print(dictionary)
Expected result would be: d = {[1,2,3,4]:"value1", [2,1,3,4]:"value2"]}