So for example, if I have the sequence [1,2,3], what would be an algorithm to produce the subseqeunces:
[1]
[2]
[3]
[1,2]
[2,3]
[1,2,3]
but not
[1,3]
nor
[3,2]
I’m then hoping to insert these as the keys in a dictionary along with the result from looking up these unique subsets in a database forming the value. I wonder if you could help with that?
Thanks very much!
Or to get them in the order you requested:
You can’t use lists as keys in a dictionary because a dictionary requires that its keys are hashable and you can’t hash lists.
You’ll need to use tuples as your keys instead.