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