let's take an example, x = [2, 5, 8] expected output = (2, 5, 8, (2, 5), (2, 8), (5, 8), (2, 5, 8)) the answer would be in any one of list or tuple. This is my code.
BigList = [2, 5, 8]
lists = []
for i in range(len(BigList)-1):
lists.append(BigList[i])
for j in range(i, len(BigList)):
if BigList[i] != BigList[j]:
lists.append((BigList[i], BigList[j]))
l = list(lists)+[BigList] +[BigList[-1]]
for this I'm able to get what I want but if input array changes to [1, 3, 5, 7, 9], won't get all possible unique combinations. (NOTE: Don't want to use collection module). Thanks in advance