I have a list and I want all possible combinations of items of a list.
from itertools import combinations
l = [1,2,3]
for i in combinations(l,2):
print(i) // (1, 2) (1,3) (2,3)
I want the same output but without using the itertools. I tried:
l = [1,2,3]
for i in l:
for j in l:
print((i,j)) // (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)
How can I get the same output without using itertools?