You are viewing a single comment's thread. Return to all comments →
width = len(bin(n)[2:]) for i in range(1, n+1): print( str(i).rjust(width), # Decimal column oct(i)[2:].rjust(width), # Octal column without '0o' hex(i)[2:].upper().rjust(width), # Hexadecimal column without '0x' bin(i)[2:].rjust(width) # Binary column without '0b' )
Seems like cookies are disabled on this browser, please enable them to open this website
String Formatting
You are viewing a single comment's thread. Return to all comments →