Files
mathgenerator/mathgenerator/funcs/binary_to_hex.py
2020-10-21 14:34:42 -04:00

16 lines
381 B
Python

from .__init__ import *
def binaryToHexFunc(max_dig=10):
problem = ''
for i in range(random.randint(1, max_dig)):
temp = str(random.randint(0, 1))
problem += temp
solution = hex(int(problem, 2))
return problem, solution
binary_to_hex = Generator("Binary to Hexidecimal", 64, "Hexidecimal of a=",
"b", binaryToHexFunc)