I want to check every number with every number in a list without repeating any checks. This code:
a = [0,1,2,3,4]
b = a
for i in a :
for j in b:
print(i,j)
del b[0]
It gives the output:
0 0
0 1
0 2
0 3
0 4
2 1
2 2
2 3
2 4
4 2
4 3
4 4
The output I want is:
0 0
0 1
0 2
0 3
0 4
1 1
1 2
1 3
1 4
2 2
2 3
2 4
3 3
3 4
4 4
Why does i skip 1 and 3? It is fixed when I remove the line 'del b[0]' but to my understanding, this line should not have any impact on the value of 'i'