You are viewing a single comment's thread. Return to all comments →
def print_formatted(number): for i in range(1,number+1): w=len(bin(number)[2:]) decimal=int(i) print(str(decimal).rjust(w),end=' ') octal=oct(i)[2:] print(octal.rjust(w),end=' ') hexa=hex(i)[2:].upper() print(hexa.rjust(w),end=' ') binary=bin(i)[2:] print(binary.rjust(w))
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 →