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.
for i in range(1,n+1):
ws=len(bin(number)[2:])
decimal=str(i).rjust(ws)
octal=oct(i)[2:].upper().rjust(ws)
hexadecimal=hex(i)[2:].upper().rjust(ws)
binary=bin(i)[2:].upper().rjust(ws)
print(decimal,octal,hexadecimal,binary)
Cookie support is required to access HackerRank
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 →