You are viewing a single comment's thread. Return to all comments →
You could use this...:
from future import print_function
st=int(raw_input())
w=len(bin(st)[2:])
for i in range(1,st+1):
print (str(i).rjust(w,' '),str(oct(i)[1:]).rjust(w,' '),str(hex(i)[2:].upper()).rjust(w,' '),str(bin(i)[2:]).rjust(w,' '),sep=' ')
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 →
You could use this...:
from future import print_function
st=int(raw_input())
w=len(bin(st)[2:])
for i in range(1,st+1):