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.
defprint_formatted(number):# your code goes herewidth=len(str(bin(n)))-2fornuminrange(1,n+1):decimal=int(num)octal=oct(num)hexadecimal=hex(num)binary=bin(num)print(str(decimal).rjust(width),octal[2:].rjust(width),hexadecimal[2:].title().rjust(width),binary[2:].rjust(width))
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 →