zero_shubham1

space padding

Dec 21st, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. n = int(raw_input())
  2. spacing = len(bin(n)[2:])
  3.  
  4. for i in range(1,n+1):
  5.     print str(i).rjust(spacing, ' '),str(oct(i)[1:]).rjust(spacing, ' '),str(hex(i)[2:].upper()).rjust(spacing, ' '),str(bin(i)[2:]).rjust(spacing, ' ')
Add Comment
Please, Sign In to add comment