+ 2
Can anyone explain this to me
Why does this code always print in a different order can anyone explain why Iâm watching a tutorial and their code prints it in order Maybe we are using different versions of python https://code.sololearn.com/c3gBeVVCUeAB/?ref=app
4 Answers
+ 6
Your shopping_list is a set, because you defined it using braces { ... }.
Sets are unordered, that's why you never get the same order when you pass over its elements.
You should make your shopping_list be a list by defining it with square brackets [ ... ].
+ 1
ty for the fast reply i was actually thinking if it was the braces ty very much
0
What are your Python version ?
0
That's an interesting code :)



