import math
def hexToDec(hexi):
result = 0
for i in range(len(hexi)-1,-1,-1):
if hexi[i] == 'A':
result = result + (10 * math.pow(16,i))
elif hexi[i] == 'B':
result = result + (11 * math.pow(16,i))
elif hexi[i] == 'C':
result = result + (12 * math.pow(16,i))
elif hexi[i] == 'D':
result = result + (13 * math.pow(16,i))
elif hexi[i] == 'E':
result = result + (14 * math.pow(16,i))
elif hexi[i] == 'F':
result = result + (15 * math.pow(16,i))
else:
result = result + (int(hexi[i]) * math.pow(16,i))
return result
Even after reversing the range order and reimporting I still get the same results.