You are viewing a single comment's thread. Return to all comments →
a=[] for i in range(1,number+1): b="" d=format(i, 'X') e=format(i,"o") f=format(i,'b') g=format(number,'b') b=" "(len(f"{number}")-len(f"{i}"))+f" {i}"+" "(len(g)-(len(e)-1))+f"{e}"+" "(len(g)-(len(d)-1))+f"{d}"+" "(len(g)-(len(f)-1))+f"{f}" a.append(b)
c="\n".join(a) print(c) return c
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
String Formatting
You are viewing a single comment's thread. Return to all comments →
a=[] for i in range(1,number+1): b="" d=format(i, 'X') e=format(i,"o") f=format(i,'b') g=format(number,'b') b=" "(len(f"{number}")-len(f"{i}"))+f" {i}"+" "(len(g)-(len(e)-1))+f"{e}"+" "(len(g)-(len(d)-1))+f"{d}"+" "(len(g)-(len(f)-1))+f"{f}" a.append(b)