This is the first time I will review the python language from the Python wikibook .
For sets, the following is mentioned - We can also have a loop move over each of the items in a set. However, since sets are unordered, it is undefined which order the iteration will follow.
and the given code example
s = set("blerg")
for letter in s:
print letter
Output
r b e l g
When I run the program, I get the results in the same order, no matter how many times I run. If the sets are unordered and the iteration order is undefined, why does it return the set in the same order? and what is the basis of order?
[ PS: Sorry if I misunderstood something very basic. I'm new to python]
source
share