You are viewing a single comment's thread. Return to all comments →
def print_formatted(number): ln=len(bin(number)[2:]) for i in range(number): i=i+1 b=bin(i)[2:] o=oct(i)[2:] h=hex(i)[2:] nn=str(i) print(nn.rjust(ln," "),o.rjust(ln," "),h.rjust(ln," "),b.rjust(ln," ")) if __name__ == '__main__': n = int(input()) print_formatted(n)
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 →