mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
18 lines
414 B
Python
18 lines
414 B
Python
from .__init__ import *
|
|
from ..__init__ import Generator
|
|
|
|
|
|
def BinaryToDecimalFunc(max_dig=10):
|
|
problem = ''
|
|
|
|
for i in range(random.randint(1, max_dig)):
|
|
temp = str(random.randint(0, 1))
|
|
problem += temp
|
|
|
|
solution = int(problem, 2)
|
|
return problem, solution
|
|
|
|
|
|
binaryToDecimal = Generator("Binary to Decimal", 15, "Decimal of a=", "b",
|
|
BinaryToDecimalFunc)
|