You are viewing a single comment's thread. Return to all comments →
def print_formatted(number): # your code goes here width = len(bin(number).removeprefix('0b')) methods = ['','oct','hex','bin'] prefixs = ['','0o','0x','0b'] for i in range(1,number+1): for j,k in zip(methods,prefixs): if j != '': y = eval(f"{j}({i}).removeprefix('{k}').upper()") else: y = str(i) print(y.rjust(width),end= " ") print()
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 →