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 1/6] 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 From 5b4088b1e0471cfa6f4c136c2950052890e8f197 Mon Sep 17 00:00:00 2001 From: helplessThor <66440538+helplessThor@users.noreply.github.com> Date: Mon, 19 Oct 2020 20:14:51 +0530 Subject: [PATCH 2/6] Update __init__.py Updated init.py --- mathgenerator/funcs/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index f054a11..4e4a196 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -77,3 +77,4 @@ from .absoluteDifferenceFunc import * from .vectorDotFunc import * from .binary2sComplement import * from .matrixInversion import * +from .binaryToHexaFunction import * From e797c8fa5ccd4d1c116769465a3c7dde57188d0e Mon Sep 17 00:00:00 2001 From: helplessThor <66440538+helplessThor@users.noreply.github.com> Date: Mon, 19 Oct 2020 20:16:30 +0530 Subject: [PATCH 3/6] Delete binaryToHexaFunction.py --- mathgenerator/funcs/binaryToHexaFunction.py | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 mathgenerator/funcs/binaryToHexaFunction.py diff --git a/mathgenerator/funcs/binaryToHexaFunction.py b/mathgenerator/funcs/binaryToHexaFunction.py deleted file mode 100644 index e40f775..0000000 --- a/mathgenerator/funcs/binaryToHexaFunction.py +++ /dev/null @@ -1,11 +0,0 @@ -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 From 65a56b69156415b28cd4fab77e786ef925be61f1 Mon Sep 17 00:00:00 2001 From: helplessThor <66440538+helplessThor@users.noreply.github.com> Date: Mon, 19 Oct 2020 20:23:11 +0530 Subject: [PATCH 4/6] Create deciToHexaFunc.py --- mathgenerator/funcs/deciToHexaFunc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 mathgenerator/funcs/deciToHexaFunc.py diff --git a/mathgenerator/funcs/deciToHexaFunc.py b/mathgenerator/funcs/deciToHexaFunc.py new file mode 100644 index 0000000..a815e34 --- /dev/null +++ b/mathgenerator/funcs/deciToHexaFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def deciToHexaFunc(max_dec=1000): + a = random.randint(0, max_dec) + b = hex(a) + problem = "Binary of " + str(a) + "=" + solution = str(b) + + return problem, solution From 649bccd330fde850500a32c883780596a1a9e121 Mon Sep 17 00:00:00 2001 From: helplessThor <66440538+helplessThor@users.noreply.github.com> Date: Mon, 19 Oct 2020 20:29:22 +0530 Subject: [PATCH 5/6] Update __init__.py updated init.py --- mathgenerator/funcs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 4e4a196..288327f 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -77,4 +77,4 @@ from .absoluteDifferenceFunc import * from .vectorDotFunc import * from .binary2sComplement import * from .matrixInversion import * -from .binaryToHexaFunction import * +from .deciToHexaFunc import * From 90c4c43aea151ff6120e14c9704ab47b929b39bd Mon Sep 17 00:00:00 2001 From: helplessThor <66440538+helplessThor@users.noreply.github.com> Date: Mon, 19 Oct 2020 20:33:45 +0530 Subject: [PATCH 6/6] Update mathgen.py added generator class --- mathgenerator/mathgen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 3bf1417..7589e04 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -108,4 +108,5 @@ angleBtwVectors=Generator("Angle between 2 vectors", 70, "Angle Between 2 vector absoluteDifference=Generator("Absolute difference between two numbers", 71, "Absolute difference betweeen two numbers a and b =", "|a-b|", absoluteDifferenceFunc) vectorDot = Generator("Dot Product of 2 Vectors", 72, "a . b = ", "c", vectorDotFunc) binary2sComplement = Generator("Binary 2's Complement", 73, "2's complement of 11010110 =", "101010", binary2sComplementFunc) -invertmatrix = Generator("Inverse of a Matrix", 74, "Inverse of a matrix A is", "A^(-1)", matrixInversion) \ No newline at end of file +invertmatrix = Generator("Inverse of a Matrix", 74, "Inverse of a matrix A is", "A^(-1)", matrixInversion) +decimalToHexadeci = Generator("Decimal to Hexadecimal", 78,"Binary of a=", "b", deciToHexaFunc)