Liam, > Just looking at this - > i = 456 > s = '' > while i: > s = str(i % 2) + s > i/=2 > > This works, far simpler than mine, which is always infuriating, but my > question is, how exactly?
This is the classic math treatment of how to calculate a binary number. Just keep dividing by two and take the remainder into the number. Almost any math textbook will cover this approach. The snag is that from a computing point of view its pretty slow so computer texts usually highlught a lookup approach 8instead. Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor