+ 2

Problem with dictionary

b = {7, 8, 9} print(b) #Output: {8, 9, 7} Why output is not {7, 8, 9} 🤔??

12th May 2022, 9:07 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar
4 odpowiedzi
+ 6
It's not dictionary. It's a set. And Set does not maintain it's order. so order is unpredictable. dictionary will have key-value pairs.
12th May 2022, 9:12 AM
Jayakrishna 🇮🇳
+ 3
As Jayakrishna🇮🇳 has already stated b = {8, 7, 9} print(type(b)) #Output: <class "set">
12th May 2022, 9:14 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Thank you Jayakrishna🇮🇳 & Rik Wittkopp ❤️🙂
12th May 2022, 9:23 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar
+ 2
Now i understand
12th May 2022, 9:23 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar