Normal working of extend method
stack=[]
stack.extend("1")
stack.extend("2")
stack.extend("3")
print(stack)
>>['1', '2', '3']
Now let us try to extend this list with a set
set1 = set(['B','C'])
stack.extend(set1)
print(stack)
>>['1', '2', '3', 'C', 'B']
Why is set getting appended as 'C' and then 'B' and not 'B' and'C' instead.I am expecting an output of ['1', '2', '3', 'B', 'C']