Find out all combinations in a list but cannot be duplicated

26 Views Asked by At

I have a list: ['1','2','3','4']

I would like to find out all combination within the list but not allow duplicated values ("1|2"=="2|1")

Output:

1|1
1|2
1|3
1|4
2|2
2|3
2|4
3|3
3|4
4|4
list=['1','2','3','4']
list2= list
for img1 in list:
    for img2 in list2:
        print(img1,"|",img2)
    list2.remove(img1)
0

There are 0 best solutions below