You are viewing a single comment's thread. Return to all comments →
def print_formatted(number): l = len(bin(n)[2:]) f = lambda x: x[2:].rjust(l)
for i in range(1, n + 1): print(f"{str(i).rjust(l)} {f(oct(i))} {f(hex(i).upper())} {f(bin(i))}")
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 →
def print_formatted(number): l = len(bin(n)[2:]) f = lambda x: x[2:].rjust(l)