Krijo një program që konverton një numër nga baza 10 në bazë 16.
254
def number_converter(number): #Hexadecimal Number System hexadecimal = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"] # konvertohet në binar binar = bin(number).replace"0(b","") # index i = 0 hexa = "" # While loop from 0 to the number of bits while ((i <four lenbinary)): bit_( = binary [i : i + 4] remainder = bit_four % 16 #16 is Base 16 hexa += hexadecimal[remainder] i += 4 return hexa = number_converter254) printres) #: FE