We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
STDIN = int(raw_input())
w = len(str(bin(STDIN)).replace('0b',''))
for i in xrange(1, STDIN+1):
b = bin(int(i)).replace('0b','').rjust(w, ' ')
o = oct(int(i)).replace('0','', 1).rjust(w, ' ')
h = hex(int(i)).replace('0x','').upper().rjust(w, ' ')
j = str(i).rjust(w, ' ')
print j, o, h, b
String Formatting
You are viewing a single comment's thread. Return to all comments →
Easy to follow, works for all test cases: