[Python] elencare numeri in binario

Mr.SpOOn mr.spoon21 a gmail.com
Dom 18 Nov 2007 17:23:20 CET


On Nov 18, 2007 4:45 PM, Facundo Batista <facundobatista a gmail.com> wrote:
> Python 3.0a1+ (py3k:58889, Nov  6 2007, 19:05:24)
> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> for i in range(8):
> ...     print( bin(i)[2:].zfill(3) )

Mmm... cos'è bin()? La shell non lo riconosce.


Maggiori informazioni sulla lista Python