Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Decimal, Octal, Hexadecimal and Binary Format
#integer value for the limit.Here it is 101, can be changed. n=101 #For spacing between the each column, based on the integer limit given. spacing = len(bin(n)[2:]) print ("Decimal".rjust(spacing, ' ')+"Octal".rjust(spacing+1, ' ')+"HexaDeci".rjust(spacing+2, ' ')+"Binary".rjust(spacing, ' ')) for i in range(1,n+1): print (str(i).rjust(spacing, ' '),str(oct(i)[1:]).replace('o','').rjust(spacing, ' '),str(hex(i)[2:].upper()).rjust(spacing, ' '),str(bin(i)[2:]).rjust(spacing, ' ') )
run
|
edit
|
history
|
help
0
Reading XML file
tip calculation
Python.py
Email_Python
inverse matrix gauss jordan
Python.py
Convert list into set
QuickSort
First python practice
StringManipulation