# to binary
print( format(14 , 'b')) # display 1110
# to hexadecimal
print(format(255, '#x'), format(255, 'x'), format(255, 'X')) # display 0xff ff FF
# to octal
print(format(10, '#o'), format(10, 'o'))# display 0o12 12
print("-------------------------------------")
print(format(10,'b')) # display 1010

# from hexadecimal to binary
print(format(0xA,'b')) # display 1010

Younes Derfoufi
my-courses.net

Leave a Reply