decimal to hex converter function (python) -


so code , dictionary have created:

def dectohex (number, dectohex_table):     final_dectohex=''     if number in dectohex_table:         final_dectohex+=dectohex_table[number]     print(final_dectohex)  dectohex_table={'0':'0', '1':'1', '2':'2', '3':'3', '4':'4', '5':'5', '6':'6', '7':'7', '8':'8', '9':'9', '10':'a', '11':'b', '12':'c', '13':'d' , '14':'e', '15':'f'}  

is there way use code using dictionary (since must) convert numbers higher 15?

i'm guessing homework (since python has hex function built-in)

what should modulo operation % , loops :)

i don't want spell out think how break base 16 number using modulo..

hint: try following:

print(423 % 10) print( (423/10) % 10) print( ((423/10)/10) % 10) 

Popular posts from this blog