Python Sets - Don't Make Me Repeat Myself!
(Page 5 of 6 )
You can also perform loops on Sets. Just keep in mind that Sets have no specific order.
usr/local/bin/python
bigword = Set ("acetylsalicyclic")
for n in bigword:
print n,
This will print out every letter in the word acetylsalicyclic. Again since there is no order in Sets, it will print the letters out randomly:
a t y e c l a s i l c c t y i c
Next: Using Operators on Sets >>
More Python Articles
More By James Payne