Hexadécimal
0-9 A-F16 = 2⁴ → un chiffre hexa = exactement 4 bits.
hex(255)'0xff'
int('FF', 16)255
#FF5733
Couleur RGB web
0x7fff0000
Adresse mémoire typique
Base 16, nbits, overflow
16 = 2⁴ → un chiffre hexa = exactement 4 bits.
hex(255)int('FF', 16)Entiers machine finis : pas les entiers mathématiques ℤ.
print(hex(255)) # '0xff'
print(int('FF', 16)) # 255
print(0xB5) # 181
# Couleur web #FF5733
rouge = int('FF', 16)
vert = int('57', 16)
bleu = int('33', 16)
1011 0101₂ = B5₁₆ = 0xB5.