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