I am trying to understand how this for loops works exactly. I have a list of letters (first_list = ["A","B","C"]), and I want to print all the possible lists without each letter (["B","C"]; ["A","C"], ["A","B"]). I have this loop, but I do not understand why it does not work:
first_list = ["A","B","C"]
for i in first_list:
second_list = first_list
second_list.remove(i)
print(second_list)
--> ['B', 'C']
['B']
On the other hand I have this loop, and it works, but I also do not understand why it works, and what is the difference in both loops
first_list = ["A","B","C"]
for i in first_list:
first_list = ["A","B","C"]
second_list = first_list
second_list.remove(i)
print(second_list)
-->['B', 'C']
['A', 'C']
['A', 'B']
Can you help me understand how these two for loops work, and is there another way to have this output (with something other than a for loop)?