Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Attempt to break cpu limit


            
                
            
 run  | edit  | history  | help 2

test

  by  renz, 7 years ago


integer value for the limit.Here it is 101, can be changed.

n=101

For spacing between the each column, based on the integer limit given.

spacing = len(bin(n)[2:])

print "Decimal".rjust(spacing, ' ')+"Octal".rjust(spacing+1, ' ')+"HexaDeci".rjust(spacing+2, ' ')+"Binary".rjust(spacing, ' ')

for i in range(1,n+1): print str(i).rjust(spacing, ' '),str(oct(i)[1:]).rjust(spacing, ' '),str(hex(i)[2:].upper()).rjust(spacing, ' '),str(bin(i)[2:]).rjust(spacing, ' ')

  by  ahmedccc, 2 months ago




Please log in to post a comment.
u