I am running this code on Python3 shell.
numberList = [1, 2, 3]
strList = ['one', 'two', 'three']
result=zip(numberList, strList)
resultSet=set(result) #1
resultList=list(result) #2
print(resultSet)
print(resultList)
and I am very surprised with the outcome :
{(1, 'one'), (3, 'three'), (2, 'two')}
[] <<< Why?
Further, when I swap line#1
with line#2
, the outcome is similar to the earlier one:
set() <<< Why?
[(1, 'one'), (2, 'two'), (3, 'three')]
What could be the reason behind later one being empty? Am I missing any concept here? FYI, I am relatively new to Python.