I have been trying to study the simplest of things and would appreciate if someone explains why this behaves the way it does. Code snippet below:
#Creating dict from set using enumerate:
myset = {'A','A','B','C'}
mydict = dict(enumerate(myset))
print(mydict)
Output:
{0: 'B', 1: 'C', 2: 'A'}
My Expected Output:
{0: 'A', 1: 'B', 2: 'C'}
Whereas, it works fine with lists!
#Creating dict from list using enumerate:
li = ["apple","banana","mango"]
mydict = dict(enumerate(myset))
print(mydict)
Output:
{0: 'apple', 1: 'banana', 2: 'mango'}
Explanation appreciated!