Answer::
def print_formatted(number):
width=len(bin(n)[2:])
for i in range(1,number+1):
print(str(i).rjust(width),oct(i)
.replace("0o","").
rjust(width),hex(i)[2:]
.upper().replace("0x","").
rjust(width),bin(i).
replace("0b","").rjust(width))
if __name__ == '__main__':
n = int(input())
print_formatted(n)
0 Comments