The
for
statement works directly with
sets, because they are iterable. A
set is not a sequence, but it is like a sequence
because we can iterate through the elements using a
for
statement.
Here we create three sets:
even, odd and
zero to reflect some standard outcomes in Roulette.
The union of all three sets is the complete
set of possible spins. We can iterate through
this resulting set.
>>> even= set( range(2,38,2) )
>>> odd= set( range(1,37,2) )
>>> zero= set( (0,'00') )
>>> for n in even|odd|zero:
print n