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.
def print_formated(n):
w = len("{0:b}".format(n))
for i in range(1,n+1):
print ("{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}".format(i, width=w))
if name=='main':
n=int(input())
print_formated(n)
String Formatting
You are viewing a single comment's thread. Return to all comments →
it's working, write this.
def print_formated(n): w = len("{0:b}".format(n)) for i in range(1,n+1): print ("{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}".format(i, width=w)) if name=='main': n=int(input()) print_formated(n)