How to convert decimal number into binary, hexadecimal and octal number Python

1 Answer

0 votes
dec = 255

print("binary = ", bin(dec))
print("hexadecimal = ", hex(dec))
print("octal = ", oct(dec))

'''
run:

binary =  0b11111111
hexadecimal =  0xff
octal =  0o377

'''

 



answered May 30, 2017 by avibootz

Related questions

...