From 24493200820139ca0ba53e16074fcf077dfcc921 Mon Sep 17 00:00:00 2001 From: helplessThor <66440538+helplessThor@users.noreply.github.com> Date: Mon, 19 Oct 2020 20:10:45 +0530 Subject: [PATCH] Create binaryToHexaFunction.py Binary to Hexadecimal conversion function file --- mathgenerator/funcs/binaryToHexaFunction.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 mathgenerator/funcs/binaryToHexaFunction.py diff --git a/mathgenerator/funcs/binaryToHexaFunction.py b/mathgenerator/funcs/binaryToHexaFunction.py new file mode 100644 index 0000000..e40f775 --- /dev/null +++ b/mathgenerator/funcs/binaryToHexaFunction.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def binaryToHexaFunc(max_dig=1000): + problem = '' + for i in range(random.randint(1, max_dig)): + temp = str(random.randint(0, 1)) + problem += temp + + solution = hex(int(problem)) + return problem, solution