Building loop with some exceptions?
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Tue Nov 4 15:40:35 EST 2008
Gilles Ganault:
> Thanks a lot but... I don't know what the above means :-/
set(iterable) just builds a set, then you use the really usual set
semantics.
Anyway, maybe you may find this more easy to understand:
refused_indexes = set([4, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89])
for i in xrange(1, 100):
if i not in refused_indexes:
print i
Note: never put a zero before an integer number (because it will give
you troubles, defining octal numbers).
Bye,
bearophile
More information about the Python-list
mailing list