Jul-16-2021, 02:15 AM
hi
this is my coding to convert HEX to Binary :
like a text "1101110110110101100" so that i can assign each and give every single one of them a declaration like this
binary position 19 = 0.5
binary position 18 = 0.25 ... etc
in the end i want to do a simple check and add function :
if binary 19 = 1, binary 18 =1, 0.5 + 0.25 etc..
the results will be something like 0.0011.
anyone got an idea how to convert or assign each binary position a value?
appreciate your help here :)
this is my coding to convert HEX to Binary :
# conversion of hex string # to binary string import math # Initialising hex string ini_string = "6EDAC" # Printing initial string print ("Initial string", ini_string) # Code to convert hex to binary res = "{0:08b}".format(int(ini_string, 16)) # Print the resultant string print ("Resultant string", str(res))and the results I've got is 1101110110110101100 in binary, i would like to covert them into text in python,
like a text "1101110110110101100" so that i can assign each and give every single one of them a declaration like this
binary position 19 = 0.5
binary position 18 = 0.25 ... etc
in the end i want to do a simple check and add function :
if binary 19 = 1, binary 18 =1, 0.5 + 0.25 etc..
the results will be something like 0.0011.
anyone got an idea how to convert or assign each binary position a value?
appreciate your help here :)