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.
Script kiddie here. I'm thinking that I could replace removeprefix with some sort of replace syntax. (giving credit to Anisha for a clean script)
for a in range(number): #First we set up up a range
w = len(format(number, 'b'))
a=a+1
b = str(a)
print(b.rjust(w), oct(a).removeprefix("0o").rjust(w),hex(a).removeprefix("0x").rjust(w).upper(),bin(a).removeprefix("0b").rjust(w))
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 →
Script kiddie here. I'm thinking that I could replace removeprefix with some sort of replace syntax. (giving credit to Anisha for a clean script)
for a in range(number): #First we set up up a range w = len(format(number, 'b')) a=a+1 b = str(a) print(b.rjust(w), oct(a).removeprefix("0o").rjust(w),hex(a).removeprefix("0x").rjust(w).upper(),bin(a).removeprefix("0b").rjust(w))