> You should be able to find a tutorial on this on-line somewhere.
> 
> you know that
> decimal: 1  = binary: 0001
> decimal: 2 = binary: 0010
> decimal: 4 = binary: 0100
> decimal: 8 = binary: 1000
> 
> Do you see the pattern here?
> It's powers of 2.

You can use the math approach or a slightly simpler way 
from a computing point of view is to convert to octal first 
then print the binary representation of each octal 
number(3 bits). You can store the octal numbers and 
their binary representations in a dictionary - only 8 entries

And you can convert to octal using int()

Some ideas to try...

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to