String Formatting

  • + 0 comments

    **def print_formatted(number): for i in range(1, n+1): print(str(i).rjust(2),str(oct(i))[2:].rjust(2),str(hex(i))[2:].upper().rjust(2),str(bin(i))[2:].rjust(2))

    if name == 'main': n = int(input()) print_formatted(n)**