mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Create binaryToHexaFunction.py
Binary to Hexadecimal conversion function file
This commit is contained in:
11
mathgenerator/funcs/binaryToHexaFunction.py
Normal file
11
mathgenerator/funcs/binaryToHexaFunction.py
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user